@leofcoin/messages 1.3.3 → 1.3.4
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/messages/block.js +44 -44
- package/exports/messages/bw-request.js +9 -9
- package/exports/messages/bw.js +11 -11
- package/exports/messages/contract.js +11 -11
- package/exports/messages/last-block-request.js +9 -9
- package/exports/messages/last-block.js +11 -11
- package/exports/messages/transaction.js +16 -16
- package/exports/messages/validator.js +11 -11
- package/exports/typings/index.d.ts +8 -8
- package/exports/typings/messages/block.d.ts +24 -24
- package/exports/typings/messages/bw-request.d.ts +5 -5
- package/exports/typings/messages/bw.d.ts +5 -5
- package/exports/typings/messages/contract.d.ts +5 -5
- package/exports/typings/messages/last-block-request.d.ts +5 -5
- package/exports/typings/messages/last-block.d.ts +5 -5
- package/exports/typings/messages/publish.d.ts +5 -5
- package/exports/typings/messages/transaction.d.ts +5 -5
- package/exports/typings/messages/validator.d.ts +5 -5
- package/exports/typings/protos/block.proto.d.ts +10 -10
- package/exports/typings/protos/bw-request.proto.d.ts +2 -2
- package/exports/typings/protos/bw.proto.d.ts +5 -5
- package/exports/typings/protos/contract.proto.d.ts +6 -6
- package/exports/typings/protos/last-block-request.proto.d.ts +2 -2
- package/exports/typings/protos/last-block.proto.d.ts +5 -5
- package/exports/typings/protos/publish.proto.d.ts +8 -8
- package/exports/typings/protos/transaction.proto.d.ts +10 -10
- package/exports/typings/protos/validator.proto.d.ts +5 -5
- package/exports/typings/workers/transaction-worker.d.ts +1 -1
- package/exports/workers/transaction-worker.js +12 -12
- package/package.json +33 -33
- package/rollup.config.js +55 -55
- package/src/index.ts +9 -9
- package/src/messages/block.ts +56 -56
- package/src/messages/bw-request.ts +13 -13
- package/src/messages/bw.ts +13 -13
- package/src/messages/contract.ts +12 -12
- package/src/messages/last-block-request.ts +13 -13
- package/src/messages/last-block.ts +13 -13
- package/src/messages/publish.ts +13 -13
- package/src/messages/transaction.ts +13 -13
- package/src/messages/validator.ts +13 -13
- package/src/protos/block.proto.js +9 -9
- package/src/protos/bw-request.proto.js +2 -2
- package/src/protos/bw.proto.js +4 -4
- package/src/protos/contract.proto.js +5 -5
- package/src/protos/last-block-request.proto.js +2 -2
- package/src/protos/last-block.proto.js +4 -4
- package/src/protos/publish.proto.js +7 -7
- package/src/protos/transaction.proto.js +9 -9
- package/src/protos/validator.proto.js +4 -4
- package/test.js +56 -56
- package/tsconfig.json +15 -15
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@leofcoin/messages",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": "./exports/index.js",
|
|
7
|
-
"./block": "./exports/block.js",
|
|
8
|
-
"./bw-request": "./exports/bw-request.js",
|
|
9
|
-
"./bw": "./exports/bw.js",
|
|
10
|
-
"./contract": "./exports/contract.js",
|
|
11
|
-
"./last-block-request": "./exports/last-block-request.js",
|
|
12
|
-
"./last-block": "./exports/last-block.js",
|
|
13
|
-
"./transaction": "./exports/transaction.js"
|
|
14
|
-
},
|
|
15
|
-
"type": "module",
|
|
16
|
-
"typings": "./exports/typings/index.d.ts",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "rollup -c",
|
|
19
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [],
|
|
22
|
-
"author": "",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@rollup/plugin-typescript": "^11.0.0",
|
|
26
|
-
"rollup": "^3.10.0",
|
|
27
|
-
"tslib": "^2.4.1"
|
|
28
|
-
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"@leofcoin/codec-format-interface": "^1.6.5",
|
|
31
|
-
"@vandeurenglenn/easy-worker": "^1.0.2"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@leofcoin/messages",
|
|
3
|
+
"version": "1.3.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./exports/index.js",
|
|
7
|
+
"./block": "./exports/block.js",
|
|
8
|
+
"./bw-request": "./exports/bw-request.js",
|
|
9
|
+
"./bw": "./exports/bw.js",
|
|
10
|
+
"./contract": "./exports/contract.js",
|
|
11
|
+
"./last-block-request": "./exports/last-block-request.js",
|
|
12
|
+
"./last-block": "./exports/last-block.js",
|
|
13
|
+
"./transaction": "./exports/transaction.js"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"typings": "./exports/typings/index.d.ts",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "rollup -c",
|
|
19
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
26
|
+
"rollup": "^3.10.0",
|
|
27
|
+
"tslib": "^2.4.1"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@leofcoin/codec-format-interface": "^1.6.5",
|
|
31
|
+
"@vandeurenglenn/easy-worker": "^1.0.2"
|
|
32
|
+
}
|
|
33
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import typescript from "@rollup/plugin-typescript"
|
|
2
|
-
import tsConfig from './tsconfig.json' assert { type: 'json'}
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default [{
|
|
6
|
-
input: ['./src/index.ts'],
|
|
7
|
-
output: {
|
|
8
|
-
format: 'es',
|
|
9
|
-
dir: './exports'
|
|
10
|
-
},
|
|
11
|
-
external: [
|
|
12
|
-
'./messages/block.js',
|
|
13
|
-
'./messages/bw.js',
|
|
14
|
-
'./messages/bw-request.js',
|
|
15
|
-
'./messages/contract.js',
|
|
16
|
-
'./messages/last-block.js',
|
|
17
|
-
'./messages/last-block-request.js',
|
|
18
|
-
'./messages/transaction.js',
|
|
19
|
-
'./messages/validator.js'
|
|
20
|
-
],
|
|
21
|
-
plugins: [
|
|
22
|
-
typescript(tsConfig)
|
|
23
|
-
]
|
|
24
|
-
}, {
|
|
25
|
-
input: [
|
|
26
|
-
'./src/messages/block.ts',
|
|
27
|
-
'./src/messages/bw.ts',
|
|
28
|
-
'./src/messages/bw-request.ts',
|
|
29
|
-
'./src/messages/contract.ts',
|
|
30
|
-
'./src/messages/last-block.ts',
|
|
31
|
-
'./src/messages/last-block-request.ts',
|
|
32
|
-
'./src/messages/transaction.ts',
|
|
33
|
-
'./src/messages/validator.ts'
|
|
34
|
-
],
|
|
35
|
-
output: {
|
|
36
|
-
format: 'es',
|
|
37
|
-
dir: './exports/messages'
|
|
38
|
-
},
|
|
39
|
-
external: [
|
|
40
|
-
'./messages/block.js',
|
|
41
|
-
'./messages/bw.js',
|
|
42
|
-
'./messages/bw-request.js',
|
|
43
|
-
'./messages/contract.js',
|
|
44
|
-
'./messages/last-block.js',
|
|
45
|
-
'./messages/last-block-request.js',
|
|
46
|
-
'./messages/transaction.js',
|
|
47
|
-
'./messages/validator.js'
|
|
48
|
-
],
|
|
49
|
-
plugins: [
|
|
50
|
-
typescript({"module": "ES2022",
|
|
51
|
-
"target": "es2022",
|
|
52
|
-
"moduleResolution":"NodeNext",
|
|
53
|
-
"allowJs": true,
|
|
54
|
-
"allowSyntheticDefaultImports": true, declaration: false, declarationDir: './exports/messages', outDir: './exports/messages'})
|
|
55
|
-
]
|
|
1
|
+
import typescript from "@rollup/plugin-typescript"
|
|
2
|
+
import tsConfig from './tsconfig.json' assert { type: 'json'}
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default [{
|
|
6
|
+
input: ['./src/index.ts'],
|
|
7
|
+
output: {
|
|
8
|
+
format: 'es',
|
|
9
|
+
dir: './exports'
|
|
10
|
+
},
|
|
11
|
+
external: [
|
|
12
|
+
'./messages/block.js',
|
|
13
|
+
'./messages/bw.js',
|
|
14
|
+
'./messages/bw-request.js',
|
|
15
|
+
'./messages/contract.js',
|
|
16
|
+
'./messages/last-block.js',
|
|
17
|
+
'./messages/last-block-request.js',
|
|
18
|
+
'./messages/transaction.js',
|
|
19
|
+
'./messages/validator.js'
|
|
20
|
+
],
|
|
21
|
+
plugins: [
|
|
22
|
+
typescript(tsConfig)
|
|
23
|
+
]
|
|
24
|
+
}, {
|
|
25
|
+
input: [
|
|
26
|
+
'./src/messages/block.ts',
|
|
27
|
+
'./src/messages/bw.ts',
|
|
28
|
+
'./src/messages/bw-request.ts',
|
|
29
|
+
'./src/messages/contract.ts',
|
|
30
|
+
'./src/messages/last-block.ts',
|
|
31
|
+
'./src/messages/last-block-request.ts',
|
|
32
|
+
'./src/messages/transaction.ts',
|
|
33
|
+
'./src/messages/validator.ts'
|
|
34
|
+
],
|
|
35
|
+
output: {
|
|
36
|
+
format: 'es',
|
|
37
|
+
dir: './exports/messages'
|
|
38
|
+
},
|
|
39
|
+
external: [
|
|
40
|
+
'./messages/block.js',
|
|
41
|
+
'./messages/bw.js',
|
|
42
|
+
'./messages/bw-request.js',
|
|
43
|
+
'./messages/contract.js',
|
|
44
|
+
'./messages/last-block.js',
|
|
45
|
+
'./messages/last-block-request.js',
|
|
46
|
+
'./messages/transaction.js',
|
|
47
|
+
'./messages/validator.js'
|
|
48
|
+
],
|
|
49
|
+
plugins: [
|
|
50
|
+
typescript({"module": "ES2022",
|
|
51
|
+
"target": "es2022",
|
|
52
|
+
"moduleResolution":"NodeNext",
|
|
53
|
+
"allowJs": true,
|
|
54
|
+
"allowSyntheticDefaultImports": true, declaration: false, declarationDir: './exports/messages', outDir: './exports/messages'})
|
|
55
|
+
]
|
|
56
56
|
}]
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare type messageInput = Uint8Array | String | Object | ArrayBuffer
|
|
2
|
-
|
|
3
|
-
export { default as BlockMessage } from './messages/block.js'
|
|
4
|
-
export { default as BWMessage } from './messages/bw.js'
|
|
5
|
-
export { default as BWRequestMessage } from './messages/bw-request.js'
|
|
6
|
-
export { default as ContractMessage } from './messages/contract.js'
|
|
7
|
-
export { default as LastBlockMessage } from './messages/last-block.js'
|
|
8
|
-
export { default as LastBlockRequestMessage } from './messages/last-block-request.js'
|
|
9
|
-
export { default as TransactionMessage } from './messages/transaction.js'
|
|
1
|
+
declare type messageInput = Uint8Array | String | Object | ArrayBuffer
|
|
2
|
+
|
|
3
|
+
export { default as BlockMessage } from './messages/block.js'
|
|
4
|
+
export { default as BWMessage } from './messages/bw.js'
|
|
5
|
+
export { default as BWRequestMessage } from './messages/bw-request.js'
|
|
6
|
+
export { default as ContractMessage } from './messages/contract.js'
|
|
7
|
+
export { default as LastBlockMessage } from './messages/last-block.js'
|
|
8
|
+
export { default as LastBlockRequestMessage } from './messages/last-block-request.js'
|
|
9
|
+
export { default as TransactionMessage } from './messages/transaction.js'
|
|
10
10
|
export { default as ValidatorMessage } from './messages/validator.js'
|
package/src/messages/block.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import proto from '../protos/block.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
import TransactionMessage from './transaction.js'
|
|
4
|
-
import ValidatorMessage from './validator.js'
|
|
5
|
-
import smartConcat from '@vandeurenglenn/typed-array-smart-concat'
|
|
6
|
-
import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat'
|
|
7
|
-
|
|
8
|
-
export default class BlockMessage extends FormatInterface {
|
|
9
|
-
declare decoded: {
|
|
10
|
-
index: Number,
|
|
11
|
-
previousHash: String,
|
|
12
|
-
timestamp: String,
|
|
13
|
-
reward: Number,
|
|
14
|
-
fees: Number,
|
|
15
|
-
transactions: Uint8Array[] | Object[] | Uint8Array,
|
|
16
|
-
validators: Uint8Array[] | Object[] | Uint8Array
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get messageName() {
|
|
20
|
-
return 'BlockMessage'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
constructor(buffer: messageInput) {
|
|
24
|
-
const name = 'block-message'
|
|
25
|
-
super(buffer, proto, {name})
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
encode(): Uint8Array {
|
|
29
|
-
const decoded = this.decoded
|
|
30
|
-
const validators: Uint8Array[] = []
|
|
31
|
-
const transactions: Uint8Array[] = []
|
|
32
|
-
|
|
33
|
-
for (const validator of decoded.validators) {
|
|
34
|
-
if (validator instanceof ValidatorMessage) validators.push(validator.encoded)
|
|
35
|
-
else validators.push(new ValidatorMessage(validator).encoded)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
for (const transaction of decoded.transactions) {
|
|
39
|
-
if (transaction instanceof TransactionMessage) transactions.push(transaction.encoded)
|
|
40
|
-
else transactions.push(new TransactionMessage(transaction).encoded)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return super.encode({
|
|
44
|
-
...decoded,
|
|
45
|
-
validators: smartConcat(validators),
|
|
46
|
-
transactions: smartConcat(transactions)
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
decode() {
|
|
51
|
-
super.decode()
|
|
52
|
-
this.decoded.transactions = smartDeconcat(this.decoded.transactions as Uint8Array).map(transaction => new TransactionMessage(transaction).decoded)
|
|
53
|
-
this.decoded.validators = smartDeconcat(this.decoded.validators as Uint8Array).map(validator => new ValidatorMessage(validator).decoded)
|
|
54
|
-
return this.decoded
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
import proto from '../protos/block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
import TransactionMessage from './transaction.js'
|
|
4
|
+
import ValidatorMessage from './validator.js'
|
|
5
|
+
import smartConcat from '@vandeurenglenn/typed-array-smart-concat'
|
|
6
|
+
import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat'
|
|
7
|
+
|
|
8
|
+
export default class BlockMessage extends FormatInterface {
|
|
9
|
+
declare decoded: {
|
|
10
|
+
index: Number,
|
|
11
|
+
previousHash: String,
|
|
12
|
+
timestamp: String,
|
|
13
|
+
reward: Number,
|
|
14
|
+
fees: Number,
|
|
15
|
+
transactions: Uint8Array[] | Object[] | Uint8Array,
|
|
16
|
+
validators: Uint8Array[] | Object[] | Uint8Array
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get messageName() {
|
|
20
|
+
return 'BlockMessage'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
constructor(buffer: messageInput) {
|
|
24
|
+
const name = 'block-message'
|
|
25
|
+
super(buffer, proto, {name})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
encode(): Uint8Array {
|
|
29
|
+
const decoded = this.decoded
|
|
30
|
+
const validators: Uint8Array[] = []
|
|
31
|
+
const transactions: Uint8Array[] = []
|
|
32
|
+
|
|
33
|
+
for (const validator of decoded.validators) {
|
|
34
|
+
if (validator instanceof ValidatorMessage) validators.push(validator.encoded)
|
|
35
|
+
else validators.push(new ValidatorMessage(validator).encoded)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
for (const transaction of decoded.transactions) {
|
|
39
|
+
if (transaction instanceof TransactionMessage) transactions.push(transaction.encoded)
|
|
40
|
+
else transactions.push(new TransactionMessage(transaction).encoded)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return super.encode({
|
|
44
|
+
...decoded,
|
|
45
|
+
validators: smartConcat(validators),
|
|
46
|
+
transactions: smartConcat(transactions)
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
decode() {
|
|
51
|
+
super.decode()
|
|
52
|
+
this.decoded.transactions = smartDeconcat(this.decoded.transactions as Uint8Array).map(transaction => new TransactionMessage(transaction).decoded)
|
|
53
|
+
this.decoded.validators = smartDeconcat(this.decoded.validators as Uint8Array).map(validator => new ValidatorMessage(validator).decoded)
|
|
54
|
+
return this.decoded
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/bw-request.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class BWRequestMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'BWRequestMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'bw-request-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/bw-request.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class BWRequestMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'BWRequestMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'bw-request-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/messages/bw.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/bw.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class BWMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'BWMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'bw-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/bw.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class BWMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'BWMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'bw-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/messages/contract.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import proto from '../protos/contract.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class ContractMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'ContractMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
super(buffer, proto, {name: 'contract-message'})
|
|
11
|
-
}
|
|
12
|
-
}
|
|
1
|
+
import proto from '../protos/contract.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class ContractMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'ContractMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
super(buffer, proto, {name: 'contract-message'})
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/last-block-request.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class LastBlockRequestMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'LastBlockRequestMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'last-block-request-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/last-block-request.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class LastBlockRequestMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'LastBlockRequestMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'last-block-request-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/last-block.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class LastBlockMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'LastBlockMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'last-block-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/last-block.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class LastBlockMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'LastBlockMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'last-block-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/messages/publish.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/publish.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class BWRequestMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'PublishMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'publish-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/publish.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class BWRequestMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'PublishMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'publish-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/transaction.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class TransactionMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'TransactionMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'transaction-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/transaction.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class TransactionMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'TransactionMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'transaction-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import proto from '../protos/validator.proto.js'
|
|
2
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
-
|
|
4
|
-
export default class ValidatorMessage extends FormatInterface {
|
|
5
|
-
get messageName() {
|
|
6
|
-
return 'ValidatorMessage'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
constructor(buffer: messageInput) {
|
|
10
|
-
const name = 'validator-message'
|
|
11
|
-
super(buffer, proto, {name})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import proto from '../protos/validator.proto.js'
|
|
2
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface'
|
|
3
|
+
|
|
4
|
+
export default class ValidatorMessage extends FormatInterface {
|
|
5
|
+
get messageName() {
|
|
6
|
+
return 'ValidatorMessage'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
constructor(buffer: messageInput) {
|
|
10
|
+
const name = 'validator-message'
|
|
11
|
+
super(buffer, proto, {name})
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
index: Number(),
|
|
3
|
-
previousHash: String(),
|
|
4
|
-
timestamp: Number(),
|
|
5
|
-
reward: Number(),
|
|
6
|
-
fees: Number(),
|
|
7
|
-
transactions: new Uint8Array(),
|
|
8
|
-
validators: new Uint8Array()
|
|
9
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
index: Number(),
|
|
3
|
+
previousHash: String(),
|
|
4
|
+
timestamp: Number(),
|
|
5
|
+
reward: Number(),
|
|
6
|
+
fees: Number(),
|
|
7
|
+
transactions: new Uint8Array(),
|
|
8
|
+
validators: new Uint8Array()
|
|
9
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
}
|
package/src/protos/bw.proto.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
up: Number(),
|
|
3
|
-
down: Number()
|
|
4
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
up: Number(),
|
|
3
|
+
down: Number()
|
|
4
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
creator: String(),
|
|
3
|
-
contract: new Uint8Array(),
|
|
4
|
-
constructorParameters: Array()
|
|
5
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
creator: String(),
|
|
3
|
+
contract: new Uint8Array(),
|
|
4
|
+
constructorParameters: Array()
|
|
5
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
hash: String(),
|
|
3
|
-
index: Number()
|
|
4
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
hash: String(),
|
|
3
|
+
index: Number()
|
|
4
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
name: String(),
|
|
3
|
-
version: Number(),
|
|
4
|
-
publisher: String(),
|
|
5
|
-
entry: String(),
|
|
6
|
-
files: new Uint8Array()
|
|
7
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
name: String(),
|
|
3
|
+
version: Number(),
|
|
4
|
+
publisher: String(),
|
|
5
|
+
entry: String(),
|
|
6
|
+
files: new Uint8Array()
|
|
7
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
timestamp: Number(),
|
|
3
|
-
from: String(),
|
|
4
|
-
to: String(),
|
|
5
|
-
nonce: Number(),
|
|
6
|
-
method: String(),
|
|
7
|
-
params: Array(),
|
|
8
|
-
signature: new Uint8Array()
|
|
9
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
timestamp: Number(),
|
|
3
|
+
from: String(),
|
|
4
|
+
to: String(),
|
|
5
|
+
nonce: Number(),
|
|
6
|
+
method: String(),
|
|
7
|
+
params: Array(),
|
|
8
|
+
signature: new Uint8Array()
|
|
9
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
address: String(),
|
|
3
|
-
reward: Number()
|
|
4
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
address: String(),
|
|
3
|
+
reward: Number()
|
|
4
|
+
}
|