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

iota-tangle

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iota-tangle - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

9

dist/factory.d.ts
/// <reference types="node" />
import { Transaction } from './transaction';
import { Serializer } from './serializer';
export interface FactoryParams {
serializer: Serializer;
}
export declare class Factory {
createTransactionFromBytes(buffer: Buffer): void;
private _serializer;
constructor(params: FactoryParams);
createTransactionFromBytes(buffer: Buffer): Transaction;
}

5

dist/factory.js

@@ -5,6 +5,9 @@ "use strict";

class Factory {
constructor(params) {
this._serializer = params.serializer;
}
createTransactionFromBytes(buffer) {
const transaction = new transaction_1.Transaction();
return transaction_1.Transaction.createFromBytes(this._serializer, buffer);
}
}
exports.Factory = Factory;
/// <reference types="node" />
import { Serializer } from './serializer';
export declare const TRANSACTION_BYTES_SIZE = 1604;
export declare class Transaction {
static BYTES_SIZE: number;
static createFromBytes(serializer: Serializer, bytes: Buffer): Transaction;

@@ -6,0 +6,0 @@ private _serializer;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TRANSACTION_BYTES_SIZE = 1604;
class Transaction {
static createFromBytes(serializer, bytes) {
if (bytes.byteLength !== exports.TRANSACTION_BYTES_SIZE) {
if (bytes.byteLength !== Transaction.BYTES_SIZE) {
throw new Error('Incorrecty bytes size!');

@@ -18,2 +17,3 @@ }

}
Transaction.BYTES_SIZE = 1604;
exports.Transaction = Transaction;
{
"name": "iota-tangle",
"version": "0.0.1",
"version": "0.0.2",
"description": "Basic models and services for IOTA's tangle",

@@ -5,0 +5,0 @@ "main": "./dist/index.ts",

# iota-tangle
Basic models and services for IOTA's tangle
[![Build Status](https://travis-ci.org/alexpods/iota-tangle.svg?branch=master)](https://travis-ci.org/alexpods/iota-tangle)
import { Serializer } from './serializer'
export const TRANSACTION_BYTES_SIZE = 1604
export class Transaction {
static BYTES_SIZE = 1604
static createFromBytes(serializer: Serializer, bytes: Buffer) {
if (bytes.byteLength !== TRANSACTION_BYTES_SIZE) {
if (bytes.byteLength !== Transaction.BYTES_SIZE) {
throw new Error('Incorrecty bytes size!')

@@ -10,0 +10,0 @@ }

@@ -5,3 +5,3 @@ import { expect } from 'chai'

import { Factory } from '../src/factory'
import { Transaction, TRANSACTION_BYTES_SIZE } from '../src/transaction'
import { Transaction } from '../src/transaction'

@@ -21,3 +21,3 @@ describe('Factory', () => {

beforeEach(() => {
transactionBytes = Buffer.alloc(TRANSACTION_BYTES_SIZE)
transactionBytes = Buffer.alloc(Transaction.BYTES_SIZE)
})

@@ -34,3 +34,3 @@

expect(() => {
factory.createTransactionFromBytes(transactionBytes.slice(0, TRANSACTION_BYTES_SIZE - 10))
factory.createTransactionFromBytes(transactionBytes.slice(0, Transaction.BYTES_SIZE - 10))
}).to.throw()

@@ -37,0 +37,0 @@

@@ -7,3 +7,2 @@ {

"outDir": "./dist",
"rootDir": "./",
"removeComments": true

@@ -10,0 +9,0 @@ },

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