Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Brord van Wierst committed Sep 19, 2023
1 parent d83b414 commit b398f6e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
13 changes: 4 additions & 9 deletions bindings/nodejs/lib/types/block/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { plainToInstance } from 'class-transformer';
import { BasicBlock } from './basic';
import { BlockType } from './block';
import { BlockWrapper } from './wrapper';
import { BasicBlock } from './basic';

export * from './wrapper';
export * from './basic';
export * from './block';
export * from './basic';
export * from './wrapper';

// Here because in block.ts it causes a circular Dependecy
export const BlockDiscriminator = {
property: 'type',
subTypes: [{ value: BasicBlock, name: BlockType.Basic as any }],
};

export function parseBlockWrapper(data: any): BlockWrapper {
return plainToInstance(BlockWrapper, data) as any as BlockWrapper;
}
12 changes: 8 additions & 4 deletions bindings/nodejs/lib/types/block/core/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { IssuerId } from '../id';
import { Signature, SignatureDiscriminator } from '../signature';
import { SlotCommitmentId, SlotIndex } from '../slot';
import { u64 } from '../../utils/type-aliases';
import { Type } from 'class-transformer';
import { BlockDiscriminator } from './';
import { BasicBlock } from './basic';
import { plainToInstance, Type } from 'class-transformer';
import { Block, BlockType } from './block';
import { BasicBlock } from './basic';
import { BlockDiscriminator } from './';

/**
* Represent the object that nodes gossip around the network.
Expand Down Expand Up @@ -94,4 +94,8 @@ class BlockWrapper {
}
}

export { BlockWrapper };
function parseBlockWrapper(data: any): BlockWrapper {
return plainToInstance(BlockWrapper, data) as any as BlockWrapper;
}

export { BlockWrapper, parseBlockWrapper };

0 comments on commit b398f6e

Please sign in to comment.