@leofcoin/messages 1.3.14 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/exports/block.js CHANGED
@@ -6,13 +6,13 @@ import smartConcat from '@vandeurenglenn/typed-array-smart-concat';
6
6
  import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat';
7
7
 
8
8
  var proto = {
9
- index: Number(),
10
- previousHash: String(),
11
- timestamp: Number(),
12
- reward: BigNumber.from(0),
13
- fees: BigNumber.from(0),
14
- transactions: new Uint8Array(),
15
- validators: new Uint8Array()
9
+ index: Number(),
10
+ previousHash: String(),
11
+ timestamp: Number(),
12
+ reward: BigNumber.from(0),
13
+ fees: BigNumber.from(0),
14
+ transactions: new Uint8Array(),
15
+ validators: new Uint8Array()
16
16
  };
17
17
 
18
18
  class BlockMessage extends FormatInterface {
@@ -47,7 +47,9 @@ class BlockMessage extends FormatInterface {
47
47
  }
48
48
  decode() {
49
49
  super.decode();
50
+ // @ts-ignore
50
51
  this.decoded.transactions = smartDeconcat(this.decoded.transactions).map(transaction => new TransactionMessage(transaction).decoded);
52
+ // @ts-ignore
51
53
  this.decoded.validators = smartDeconcat(this.decoded.validators).map(validator => new ValidatorMessage(validator).decoded);
52
54
  return this.decoded;
53
55
  }
@@ -1,7 +1,6 @@
1
1
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
2
 
3
- var proto = {
4
- };
3
+ var proto = {};
5
4
 
6
5
  class BWRequestMessage extends FormatInterface {
7
6
  get messageName() {
package/exports/bw.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
2
 
3
3
  var proto = {
4
- up: Number(),
5
- down: Number()
4
+ up: Number(),
5
+ down: Number()
6
6
  };
7
7
 
8
8
  class BWMessage extends FormatInterface {
@@ -1,9 +1,9 @@
1
1
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
2
 
3
3
  var proto = {
4
- creator: String(),
5
- contract: new Uint8Array(),
6
- constructorParameters: Array()
4
+ creator: String(),
5
+ contract: new Uint8Array(),
6
+ constructorParameters: Array()
7
7
  };
8
8
 
9
9
  class ContractMessage extends FormatInterface {
package/exports/index.js CHANGED
@@ -12,12 +12,12 @@ import '@vandeurenglenn/typed-array-smart-concat';
12
12
  import '@vandeurenglenn/typed-array-smart-deconcat';
13
13
 
14
14
  var proto = {
15
- timestamp: Number(),
16
- from: String(),
17
- to: String(),
18
- nonce: Number(),
19
- method: String(),
20
- params: Array()
15
+ timestamp: Number(),
16
+ from: String(),
17
+ to: String(),
18
+ nonce: Number(),
19
+ method: String(),
20
+ params: Array()
21
21
  };
22
22
 
23
23
  class RawTransactionMessage extends FormatInterface {
@@ -1,7 +1,6 @@
1
1
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
2
 
3
- var proto = {
4
- };
3
+ var proto = {};
5
4
 
6
5
  class LastBlockRequestMessage extends FormatInterface {
7
6
  get messageName() {
@@ -1,8 +1,8 @@
1
1
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
2
 
3
3
  var proto = {
4
- hash: String(),
5
- index: Number()
4
+ hash: String(),
5
+ index: Number()
6
6
  };
7
7
 
8
8
  class LastBlockMessage extends FormatInterface {
@@ -1,25 +1,18 @@
1
+ import proto from '../protos/block.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
2
- import { BigNumber } from '@leofcoin/utils';
3
+ import type { messageInput } from '../types.js';
3
4
  export default class BlockMessage extends FormatInterface {
4
- decoded: {
5
- index: Number;
6
- previousHash: String;
7
- timestamp: String;
8
- reward: BigNumber;
9
- fees: BigNumber;
10
- transactions: Uint8Array[] | Object[] | Uint8Array;
11
- validators: Uint8Array[] | Object[] | Uint8Array;
12
- };
5
+ decoded: typeof proto;
13
6
  get messageName(): string;
14
7
  constructor(buffer: messageInput);
15
8
  encode(): Uint8Array;
16
9
  decode(): {
17
- index: Number;
18
- previousHash: String;
19
- timestamp: String;
20
- reward: BigNumber;
21
- fees: BigNumber;
22
- transactions: Uint8Array | Uint8Array[] | Object[];
23
- validators: Uint8Array | Uint8Array[] | Object[];
10
+ index: number;
11
+ previousHash: string;
12
+ timestamp: number;
13
+ reward: import("@ethersproject/bignumber").BigNumber;
14
+ fees: import("@ethersproject/bignumber").BigNumber;
15
+ transactions: Uint8Array;
16
+ validators: Uint8Array;
24
17
  };
25
18
  }
@@ -1,5 +1,8 @@
1
+ import proto from './../protos/bw-request.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class BWRequestMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer?: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/bw.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class BWMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/contract.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class ContractMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/last-block-request.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class LastBlockRequestMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/last-block.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class LastBlockMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/publish.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class BWRequestMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/raw-transaction.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class RawTransactionMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from './../protos/transaction.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class TransactionMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -1,5 +1,8 @@
1
+ import proto from '../protos/validator.proto.js';
1
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
+ import type { messageInput } from '../types.js';
2
4
  export default class ValidatorMessage extends FormatInterface {
5
+ decoded: typeof proto;
3
6
  get messageName(): string;
4
7
  constructor(buffer: messageInput);
5
8
  }
@@ -0,0 +1,11 @@
1
+ import { BigNumber } from "@leofcoin/utils";
2
+ declare const _default: {
3
+ index: number;
4
+ previousHash: string;
5
+ timestamp: number;
6
+ reward: BigNumber;
7
+ fees: BigNumber;
8
+ transactions: Uint8Array;
9
+ validators: Uint8Array;
10
+ };
11
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ up: number;
3
+ down: number;
4
+ };
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ creator: string;
3
+ contract: Uint8Array;
4
+ constructorParameters: any[];
5
+ };
6
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ hash: string;
3
+ index: number;
4
+ };
5
+ export default _default;
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ name: string;
3
+ version: number;
4
+ publisher: string;
5
+ entry: string;
6
+ files: Uint8Array;
7
+ };
8
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { RawTransaction } from '@leofcoin/types';
2
+ declare const _default: RawTransaction;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { BigNumber } from "@leofcoin/utils";
2
+ declare const _default: {
3
+ address: string;
4
+ reward: BigNumber;
5
+ };
6
+ export default _default;
@@ -0,0 +1 @@
1
+ export declare type messageInput = Uint8Array | String | Object | ArrayBuffer;
@@ -2,8 +2,8 @@ import { BigNumber } from '@leofcoin/utils';
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
3
 
4
4
  var proto = {
5
- address: String(),
6
- reward: BigNumber.from(0)
5
+ address: String(),
6
+ reward: BigNumber.from(0)
7
7
  };
8
8
 
9
9
  class ValidatorMessage extends FormatInterface {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/messages",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {