@leofcoin/messages 1.0.3 → 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 +4852 -8517
- package/dist/messages.js +77 -586
- package/dist/protons.esm +3786 -0
- package/package.json +5 -6
- package/src/messages/block.js +6 -3
- package/src/messages/bw-request.js +7 -4
- package/src/messages/bw.js +7 -4
- package/src/messages/contract.js +7 -4
- package/src/messages/last-block-request.js +7 -4
- package/src/messages/last-block.js +7 -4
- package/src/messages/transaction.js +7 -4
- package/src/messages.js +5 -13
- package/webpack.config.js +1 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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": "
|
|
6
|
+
"module": "src/messages.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rollup -c && webpack",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
"keywords": [],
|
|
12
12
|
"author": "",
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@leofcoin/codec-format-interface": "^1.0.1",
|
|
16
|
-
"protons": "^2.0.1"
|
|
17
|
-
},
|
|
18
14
|
"devDependencies": {
|
|
19
15
|
"webpack": "^5.73.0",
|
|
20
16
|
"webpack-cli": "^4.9.2"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@leofcoin/codec-format-interface": "^1.2.0"
|
|
21
20
|
}
|
|
22
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 from '
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
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 from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
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 from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
14
|
+
super(buffer, proto, {name: 'contract-message'})
|
|
12
15
|
}
|
|
13
16
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
15
|
+
super(buffer, proto, {name})
|
|
13
16
|
}
|
|
14
17
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import FormatInterface from './../../node_modules/@leofcoin/codec-format-interface/src/codec-format-interface'
|
|
1
|
+
import proto from './../protos/block.proto.js'
|
|
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,
|
|
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'
|