@leofcoin/messages 1.1.1 → 1.2.0

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/dist/messages.js CHANGED
@@ -4,30 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var codecFormatInterface = require('@leofcoin/codec-format-interface');
6
6
 
7
- var proto = `
8
- message ValidatorMessage {
9
- required string address = 1;
10
- required string reward = 2;
11
- }
12
-
13
- message Transaction {
14
- required string hash = 1;
15
- required uint64 timestamp = 2;
16
- required string from = 3;
17
- required string to = 4;
18
- required uint64 nonce = 5;
19
- required string method = 6;
20
- repeated string params = 7;
21
- }
22
-
23
- message BlockMessage {
24
- required uint64 index = 1;
25
- required string previousHash = 3;
26
- required uint64 timestamp = 4;
27
- required uint64 reward = 5;
28
- required string fees = 6;
29
- repeated Transaction transactions = 7;
30
- repeated ValidatorMessage validators = 8;
7
+ var proto$4 = `
8
+ message ContractMessage {
9
+ required string creator = 1;
10
+ required bytes contract = 2;
11
+ repeated string constructorParameters = 3;
31
12
  }
32
13
  `;
33
14
 
@@ -41,13 +22,26 @@ class ContractMessage extends codecFormatInterface.FormatInterface {
41
22
  }
42
23
 
43
24
  constructor(buffer) {
44
- super(buffer, proto, {name: 'contract-message'});
25
+ super(buffer, proto$4, {name: 'contract-message'});
45
26
  }
46
27
  }
47
28
 
29
+ var proto$3 = `
30
+
31
+ message TransactionMessage {
32
+ required uint64 timestamp = 1;
33
+ required string from = 2;
34
+ required string to = 3;
35
+ required uint64 nonce = 4;
36
+ required string method = 5;
37
+ repeated string params = 6;
38
+ required string signature = 7;
39
+ }
40
+ `;
41
+
48
42
  class TransactionMessage extends codecFormatInterface.FormatInterface {
49
43
  get keys() {
50
- return ['timestamp', 'from', 'to', 'nonce', 'method', 'params']
44
+ return ['timestamp', 'from', 'to', 'nonce', 'method', 'params', 'signature']
51
45
  }
52
46
 
53
47
  get messageName() {
@@ -56,10 +50,37 @@ class TransactionMessage extends codecFormatInterface.FormatInterface {
56
50
 
57
51
  constructor(buffer) {
58
52
  const name = 'transaction-message';
59
- super(buffer, proto, {name});
53
+ super(buffer, proto$3, {name});
60
54
  }
61
55
  }
62
56
 
57
+ var proto$2 = `
58
+ message ValidatorMessage {
59
+ required string address = 1;
60
+ required string reward = 2;
61
+ }
62
+
63
+ message Transaction {
64
+ required string hash = 1;
65
+ required uint64 timestamp = 2;
66
+ required string from = 3;
67
+ required string to = 4;
68
+ required uint64 nonce = 5;
69
+ required string method = 6;
70
+ repeated string params = 7;
71
+ }
72
+
73
+ message BlockMessage {
74
+ required uint64 index = 1;
75
+ required string previousHash = 3;
76
+ required uint64 timestamp = 4;
77
+ required uint64 reward = 5;
78
+ required string fees = 6;
79
+ repeated Transaction transactions = 7;
80
+ repeated ValidatorMessage validators = 8;
81
+ }
82
+ `;
83
+
63
84
  class BlockMessage extends codecFormatInterface.FormatInterface {
64
85
  get keys() {
65
86
  return ['index', 'previousHash', 'timestamp', 'reward', 'fees', 'transactions', 'validators']
@@ -71,10 +92,18 @@ class BlockMessage extends codecFormatInterface.FormatInterface {
71
92
 
72
93
  constructor(buffer) {
73
94
  const name = 'block-message';
74
- super(buffer, proto, {name});
95
+ super(buffer, proto$2, {name});
75
96
  }
76
97
  }
77
98
 
99
+ var proto$1 = `
100
+
101
+ message BWMessage {
102
+ required uint64 up = 1;
103
+ required uint64 down = 2;
104
+ }
105
+ `;
106
+
78
107
  class BWMessage extends codecFormatInterface.FormatInterface {
79
108
  get keys() {
80
109
  return ['up', 'down']
@@ -86,10 +115,16 @@ class BWMessage extends codecFormatInterface.FormatInterface {
86
115
 
87
116
  constructor(buffer) {
88
117
  const name = 'bw-message';
89
- super(buffer, proto, {name});
118
+ super(buffer, proto$1, {name});
90
119
  }
91
120
  }
92
121
 
122
+ var proto = `
123
+
124
+ message BWRequestMessage {
125
+ }
126
+ `;
127
+
93
128
  class BWRequestMessage extends codecFormatInterface.FormatInterface {
94
129
  get keys() {
95
130
  return []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/messages",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "dist/messages.js",
6
6
  "module": "src/messages.js",
@@ -1,4 +1,4 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/bw-request.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class BWRequestMessage extends FormatInterface {
@@ -1,4 +1,4 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/bw.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class BWMessage extends FormatInterface {
@@ -1,4 +1,4 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/contract.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class ContractMessage extends FormatInterface {
@@ -1,4 +1,4 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/last-block-request.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class LastBlockRequestMessage extends FormatInterface {
@@ -1,4 +1,4 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/last-block.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class LastBlockMessage extends FormatInterface {
@@ -1,9 +1,9 @@
1
- import proto from './../protos/block.proto.js'
1
+ import proto from './../protos/transaction.proto.js'
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface'
3
3
 
4
4
  export default class TransactionMessage extends FormatInterface {
5
5
  get keys() {
6
- return ['timestamp', 'from', 'to', 'nonce', 'method', 'params']
6
+ return ['timestamp', 'from', 'to', 'nonce', 'method', 'params', 'signature']
7
7
  }
8
8
 
9
9
  get messageName() {
@@ -7,5 +7,6 @@ message TransactionMessage {
7
7
  required uint64 nonce = 4;
8
8
  required string method = 5;
9
9
  repeated string params = 6;
10
+ required string signature = 7;
10
11
  }
11
12
  `