@leofcoin/messages 1.0.3 → 1.1.2

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/package.json CHANGED
@@ -1,22 +1,21 @@
1
- {
2
- "name": "@leofcoin/messages",
3
- "version": "1.0.3",
4
- "description": "",
5
- "main": "dist/messages.js",
6
- "module": "dist/messages.esm",
7
- "scripts": {
8
- "build": "rollup -c && webpack",
9
- "test": "echo \"Error: no test specified\" && exit 1"
10
- },
11
- "keywords": [],
12
- "author": "",
13
- "license": "MIT",
14
- "dependencies": {
15
- "@leofcoin/codec-format-interface": "^1.0.1",
16
- "protons": "^2.0.1"
17
- },
18
- "devDependencies": {
19
- "webpack": "^5.73.0",
20
- "webpack-cli": "^4.9.2"
21
- }
22
- }
1
+ {
2
+ "name": "@leofcoin/messages",
3
+ "version": "1.1.2",
4
+ "description": "",
5
+ "main": "dist/messages.js",
6
+ "module": "src/messages.js",
7
+ "scripts": {
8
+ "build": "rollup -c && webpack",
9
+ "test": "echo \"Error: no test specified\" && exit 1"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "MIT",
14
+ "devDependencies": {
15
+ "webpack": "^5.73.0",
16
+ "webpack-cli": "^4.9.2"
17
+ },
18
+ "dependencies": {
19
+ "@leofcoin/codec-format-interface": "^1.2.2"
20
+ }
21
+ }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/block.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class BlockMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return ['index', 'previousHash', 'timestamp', 'reward', 'fees', 'transactions', 'validators']
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'BlockMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'block-message'
12
- super(buffer, protons(proto).BlockMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/bw-request.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class BWRequestMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return []
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'BWRequestMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'bw-request-message'
12
- super(buffer, protons(proto).BWRequestMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/bw.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class BWMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return ['up', 'down']
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'BWMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'bw-message'
12
- super(buffer, protons(proto).BWMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
@@ -1,13 +1,16 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/contract.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class ContractMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return ['creator', 'contract', 'constructorParameters']
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'ContractMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
- super(buffer, protons(proto).ContractMessage, {name: 'contract-message'})
14
+ super(buffer, proto, {name: 'contract-message'})
12
15
  }
13
16
  }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/last-block-request.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class LastBlockRequestMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return []
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'LastBlockRequestMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'last-block-request-message'
12
- super(buffer, protons(proto).LastBlockRequestMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/last-block.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class LastBlockMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return ['hash', 'index']
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'LastBlockMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'last-block-message'
12
- super(buffer, protons(proto).LastBlockMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
@@ -1,14 +1,17 @@
1
- import protons from 'protons'
2
1
  import proto from './../protos/transaction.proto.js'
3
- import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
2
+ import { FormatInterface } from '@leofcoin/codec-format-interface'
4
3
 
5
4
  export default class TransactionMessage extends FormatInterface {
6
5
  get keys() {
7
6
  return ['timestamp', 'from', 'to', 'nonce', 'method', 'params']
8
7
  }
9
8
 
9
+ get messageName() {
10
+ return 'TransactionMessage'
11
+ }
12
+
10
13
  constructor(buffer) {
11
14
  const name = 'transaction-message'
12
- super(buffer, protons(proto).TransactionMessage, {name})
15
+ super(buffer, proto, {name})
13
16
  }
14
17
  }
package/src/messages.js CHANGED
@@ -1,13 +1,5 @@
1
- import ContractMessage from './messages/contract'
2
- import TransactionMessage from './messages/transaction'
3
- import BlockMessage from './messages/block'
4
- import BWMessage from './messages/bw'
5
- import BWRequestMessage from './messages/bw-request'
6
-
7
- export default {
8
- ContractMessage,
9
- TransactionMessage,
10
- BlockMessage,
11
- BWMessage,
12
- BWRequestMessage
13
- }
1
+ export { default as ContractMessage } from './messages/contract'
2
+ export { default as TransactionMessage } from './messages/transaction'
3
+ export { default as BlockMessage } from './messages/block'
4
+ export { default as BWMessage } from './messages/bw'
5
+ export { default as BWRequestMessage } from './messages/bw-request'
package/webpack.config.js CHANGED
@@ -15,6 +15,7 @@ module.exports = [{
15
15
  library: {
16
16
  type: 'module'
17
17
  },
18
+ chunkFilename: '[name].esm',
18
19
  filename: '[name].esm',
19
20
  path: path.resolve(__dirname, 'dist'),
20
21
  }