@leofcoin/messages 1.0.1 → 1.1.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.esm +8028 -0
- package/dist/messages.js +74 -70
- package/dist/protons.esm +3786 -0
- package/package.json +8 -4
- package/src/messages/block.js +7 -4
- package/src/messages/bw-request.js +8 -5
- package/src/messages/bw.js +8 -5
- package/src/messages/contract.js +8 -5
- package/src/messages/last-block-request.js +8 -5
- package/src/messages/last-block.js +8 -5
- package/src/messages/transaction.js +8 -5
- package/src/messages.js +5 -13
- package/webpack.config.js +22 -0
package/package.json
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/messages",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/messages.js",
|
|
6
|
-
"module": "src/messages
|
|
6
|
+
"module": "src/messages.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "rollup -c",
|
|
8
|
+
"build": "rollup -c && webpack",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "MIT",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"webpack": "^5.73.0",
|
|
16
|
+
"webpack-cli": "^4.9.2"
|
|
17
|
+
},
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"@leofcoin/codec-format-interface": "^1.0
|
|
19
|
+
"@leofcoin/codec-format-interface": "^1.2.0"
|
|
16
20
|
}
|
|
17
21
|
}
|
package/src/messages/block.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import protons from 'protons'
|
|
2
1
|
import proto from './../protos/block.proto.js'
|
|
3
|
-
import { FormatInterface
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class BlockMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {FormatInterface as CodecFormat} from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class BWRequestMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
package/src/messages/bw.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class BWMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
package/src/messages/contract.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class ContractMessage extends
|
|
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,
|
|
14
|
+
super(buffer, proto, {name: 'contract-message'})
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class LastBlockRequestMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class LastBlockMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { FormatInterface as CodecFormat } from '@leofcoin/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
4
3
|
|
|
5
|
-
export default class TransactionMessage extends
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
package/src/messages.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
ContractMessage,
|
|
9
|
-
TransactionMessage,
|
|
10
|
-
BlockMessage,
|
|
11
|
-
BWMessage,
|
|
12
|
-
BWRequestMessage
|
|
13
|
-
}
|
|
1
|
+
export * as ContractMessage from './messages/contract'
|
|
2
|
+
export * as TransactionMessage from './messages/transaction'
|
|
3
|
+
export * as BlockMessage from './messages/block'
|
|
4
|
+
export * as BWMessage from './messages/bw'
|
|
5
|
+
export * as BWRequestMessage from './messages/bw-request'
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
module.exports = [{
|
|
4
|
+
mode: 'production',
|
|
5
|
+
entry: {
|
|
6
|
+
messages: './src/messages.js'
|
|
7
|
+
},
|
|
8
|
+
optimization: {
|
|
9
|
+
minimize: false
|
|
10
|
+
},
|
|
11
|
+
experiments: {
|
|
12
|
+
outputModule: true
|
|
13
|
+
},
|
|
14
|
+
output: {
|
|
15
|
+
library: {
|
|
16
|
+
type: 'module'
|
|
17
|
+
},
|
|
18
|
+
chunkFilename: '[name].esm',
|
|
19
|
+
filename: '[name].esm',
|
|
20
|
+
path: path.resolve(__dirname, 'dist'),
|
|
21
|
+
}
|
|
22
|
+
}];
|