@leofcoin/messages 1.3.3 → 1.3.5
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 +45 -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 +34 -33
- package/rollup.config.js +55 -55
- package/src/index.ts +9 -9
- package/src/messages/block.ts +57 -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 +11 -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 +62 -56
- package/tsconfig.json +15 -15
|
@@ -1,55 +1,56 @@
|
|
|
1
|
+
import { BigNumber } from '@leofcoin/utils';
|
|
1
2
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
3
|
import TransactionMessage from './transaction.js';
|
|
3
4
|
import ValidatorMessage from './validator.js';
|
|
4
5
|
import smartConcat from '@vandeurenglenn/typed-array-smart-concat';
|
|
5
6
|
import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat';
|
|
6
7
|
|
|
7
|
-
var proto = {
|
|
8
|
-
index: Number(),
|
|
9
|
-
previousHash: String(),
|
|
10
|
-
timestamp: Number(),
|
|
11
|
-
reward:
|
|
12
|
-
fees:
|
|
13
|
-
transactions: new Uint8Array(),
|
|
14
|
-
validators: new Uint8Array()
|
|
8
|
+
var proto = {
|
|
9
|
+
index: Number(),
|
|
10
|
+
previousHash: String(),
|
|
11
|
+
timestamp: Number(),
|
|
12
|
+
reward: BigNumber.from(0),
|
|
13
|
+
fees: BigNumber.from(0),
|
|
14
|
+
transactions: new Uint8Array(),
|
|
15
|
+
validators: new Uint8Array()
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
class BlockMessage extends FormatInterface {
|
|
18
|
-
get messageName() {
|
|
19
|
-
return 'BlockMessage';
|
|
20
|
-
}
|
|
21
|
-
constructor(buffer) {
|
|
22
|
-
const name = 'block-message';
|
|
23
|
-
super(buffer, proto, { name });
|
|
24
|
-
}
|
|
25
|
-
encode() {
|
|
26
|
-
const decoded = this.decoded;
|
|
27
|
-
const validators = [];
|
|
28
|
-
const transactions = [];
|
|
29
|
-
for (const validator of decoded.validators) {
|
|
30
|
-
if (validator instanceof ValidatorMessage)
|
|
31
|
-
validators.push(validator.encoded);
|
|
32
|
-
else
|
|
33
|
-
validators.push(new ValidatorMessage(validator).encoded);
|
|
34
|
-
}
|
|
35
|
-
for (const transaction of decoded.transactions) {
|
|
36
|
-
if (transaction instanceof TransactionMessage)
|
|
37
|
-
transactions.push(transaction.encoded);
|
|
38
|
-
else
|
|
39
|
-
transactions.push(new TransactionMessage(transaction).encoded);
|
|
40
|
-
}
|
|
41
|
-
return super.encode({
|
|
42
|
-
...decoded,
|
|
43
|
-
validators: smartConcat(validators),
|
|
44
|
-
transactions: smartConcat(transactions)
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
decode() {
|
|
48
|
-
super.decode();
|
|
49
|
-
this.decoded.transactions = smartDeconcat(this.decoded.transactions).map(transaction => new TransactionMessage(transaction).decoded);
|
|
50
|
-
this.decoded.validators = smartDeconcat(this.decoded.validators).map(validator => new ValidatorMessage(validator).decoded);
|
|
51
|
-
return this.decoded;
|
|
52
|
-
}
|
|
18
|
+
class BlockMessage extends FormatInterface {
|
|
19
|
+
get messageName() {
|
|
20
|
+
return 'BlockMessage';
|
|
21
|
+
}
|
|
22
|
+
constructor(buffer) {
|
|
23
|
+
const name = 'block-message';
|
|
24
|
+
super(buffer, proto, { name });
|
|
25
|
+
}
|
|
26
|
+
encode() {
|
|
27
|
+
const decoded = this.decoded;
|
|
28
|
+
const validators = [];
|
|
29
|
+
const transactions = [];
|
|
30
|
+
for (const validator of decoded.validators) {
|
|
31
|
+
if (validator instanceof ValidatorMessage)
|
|
32
|
+
validators.push(validator.encoded);
|
|
33
|
+
else
|
|
34
|
+
validators.push(new ValidatorMessage(validator).encoded);
|
|
35
|
+
}
|
|
36
|
+
for (const transaction of decoded.transactions) {
|
|
37
|
+
if (transaction instanceof TransactionMessage)
|
|
38
|
+
transactions.push(transaction.encoded);
|
|
39
|
+
else
|
|
40
|
+
transactions.push(new TransactionMessage(transaction).encoded);
|
|
41
|
+
}
|
|
42
|
+
return super.encode({
|
|
43
|
+
...decoded,
|
|
44
|
+
validators: smartConcat(validators),
|
|
45
|
+
transactions: smartConcat(transactions)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
decode() {
|
|
49
|
+
super.decode();
|
|
50
|
+
this.decoded.transactions = smartDeconcat(this.decoded.transactions).map(transaction => new TransactionMessage(transaction).decoded);
|
|
51
|
+
this.decoded.validators = smartDeconcat(this.decoded.validators).map(validator => new ValidatorMessage(validator).decoded);
|
|
52
|
+
return this.decoded;
|
|
53
|
+
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
export { BlockMessage as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
3
|
+
var proto = {
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
class BWRequestMessage extends FormatInterface {
|
|
7
|
-
get messageName() {
|
|
8
|
-
return 'BWRequestMessage';
|
|
9
|
-
}
|
|
10
|
-
constructor(buffer) {
|
|
11
|
-
const name = 'bw-request-message';
|
|
12
|
-
super(buffer, proto, { name });
|
|
13
|
-
}
|
|
6
|
+
class BWRequestMessage extends FormatInterface {
|
|
7
|
+
get messageName() {
|
|
8
|
+
return 'BWRequestMessage';
|
|
9
|
+
}
|
|
10
|
+
constructor(buffer) {
|
|
11
|
+
const name = 'bw-request-message';
|
|
12
|
+
super(buffer, proto, { name });
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { BWRequestMessage as default };
|
package/exports/messages/bw.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
4
|
-
up: Number(),
|
|
5
|
-
down: Number()
|
|
3
|
+
var proto = {
|
|
4
|
+
up: Number(),
|
|
5
|
+
down: Number()
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
class BWMessage extends FormatInterface {
|
|
9
|
-
get messageName() {
|
|
10
|
-
return 'BWMessage';
|
|
11
|
-
}
|
|
12
|
-
constructor(buffer) {
|
|
13
|
-
const name = 'bw-message';
|
|
14
|
-
super(buffer, proto, { name });
|
|
15
|
-
}
|
|
8
|
+
class BWMessage extends FormatInterface {
|
|
9
|
+
get messageName() {
|
|
10
|
+
return 'BWMessage';
|
|
11
|
+
}
|
|
12
|
+
constructor(buffer) {
|
|
13
|
+
const name = 'bw-message';
|
|
14
|
+
super(buffer, proto, { name });
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { BWMessage as default };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
4
|
-
creator: String(),
|
|
5
|
-
contract: new Uint8Array(),
|
|
6
|
-
constructorParameters: Array()
|
|
3
|
+
var proto = {
|
|
4
|
+
creator: String(),
|
|
5
|
+
contract: new Uint8Array(),
|
|
6
|
+
constructorParameters: Array()
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
class ContractMessage extends FormatInterface {
|
|
10
|
-
get messageName() {
|
|
11
|
-
return 'ContractMessage';
|
|
12
|
-
}
|
|
13
|
-
constructor(buffer) {
|
|
14
|
-
super(buffer, proto, { name: 'contract-message' });
|
|
15
|
-
}
|
|
9
|
+
class ContractMessage extends FormatInterface {
|
|
10
|
+
get messageName() {
|
|
11
|
+
return 'ContractMessage';
|
|
12
|
+
}
|
|
13
|
+
constructor(buffer) {
|
|
14
|
+
super(buffer, proto, { name: 'contract-message' });
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { ContractMessage as default };
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
3
|
+
var proto = {
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
-
class LastBlockRequestMessage extends FormatInterface {
|
|
7
|
-
get messageName() {
|
|
8
|
-
return 'LastBlockRequestMessage';
|
|
9
|
-
}
|
|
10
|
-
constructor(buffer) {
|
|
11
|
-
const name = 'last-block-request-message';
|
|
12
|
-
super(buffer, proto, { name });
|
|
13
|
-
}
|
|
6
|
+
class LastBlockRequestMessage extends FormatInterface {
|
|
7
|
+
get messageName() {
|
|
8
|
+
return 'LastBlockRequestMessage';
|
|
9
|
+
}
|
|
10
|
+
constructor(buffer) {
|
|
11
|
+
const name = 'last-block-request-message';
|
|
12
|
+
super(buffer, proto, { name });
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { LastBlockRequestMessage as default };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
4
|
-
hash: String(),
|
|
5
|
-
index: Number()
|
|
3
|
+
var proto = {
|
|
4
|
+
hash: String(),
|
|
5
|
+
index: Number()
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
class LastBlockMessage extends FormatInterface {
|
|
9
|
-
get messageName() {
|
|
10
|
-
return 'LastBlockMessage';
|
|
11
|
-
}
|
|
12
|
-
constructor(buffer) {
|
|
13
|
-
const name = 'last-block-message';
|
|
14
|
-
super(buffer, proto, { name });
|
|
15
|
-
}
|
|
8
|
+
class LastBlockMessage extends FormatInterface {
|
|
9
|
+
get messageName() {
|
|
10
|
+
return 'LastBlockMessage';
|
|
11
|
+
}
|
|
12
|
+
constructor(buffer) {
|
|
13
|
+
const name = 'last-block-message';
|
|
14
|
+
super(buffer, proto, { name });
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { LastBlockMessage as default };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
4
|
-
timestamp: Number(),
|
|
5
|
-
from: String(),
|
|
6
|
-
to: String(),
|
|
7
|
-
nonce: Number(),
|
|
8
|
-
method: String(),
|
|
9
|
-
params: Array(),
|
|
10
|
-
signature: new Uint8Array()
|
|
3
|
+
var proto = {
|
|
4
|
+
timestamp: Number(),
|
|
5
|
+
from: String(),
|
|
6
|
+
to: String(),
|
|
7
|
+
nonce: Number(),
|
|
8
|
+
method: String(),
|
|
9
|
+
params: Array(),
|
|
10
|
+
signature: new Uint8Array()
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
class TransactionMessage extends FormatInterface {
|
|
14
|
-
get messageName() {
|
|
15
|
-
return 'TransactionMessage';
|
|
16
|
-
}
|
|
17
|
-
constructor(buffer) {
|
|
18
|
-
const name = 'transaction-message';
|
|
19
|
-
super(buffer, proto, { name });
|
|
20
|
-
}
|
|
13
|
+
class TransactionMessage extends FormatInterface {
|
|
14
|
+
get messageName() {
|
|
15
|
+
return 'TransactionMessage';
|
|
16
|
+
}
|
|
17
|
+
constructor(buffer) {
|
|
18
|
+
const name = 'transaction-message';
|
|
19
|
+
super(buffer, proto, { name });
|
|
20
|
+
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export { TransactionMessage as default };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
2
|
|
|
3
|
-
var proto = {
|
|
4
|
-
address: String(),
|
|
5
|
-
reward: Number()
|
|
3
|
+
var proto = {
|
|
4
|
+
address: String(),
|
|
5
|
+
reward: Number()
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
class ValidatorMessage extends FormatInterface {
|
|
9
|
-
get messageName() {
|
|
10
|
-
return 'ValidatorMessage';
|
|
11
|
-
}
|
|
12
|
-
constructor(buffer) {
|
|
13
|
-
const name = 'validator-message';
|
|
14
|
-
super(buffer, proto, { name });
|
|
15
|
-
}
|
|
8
|
+
class ValidatorMessage extends FormatInterface {
|
|
9
|
+
get messageName() {
|
|
10
|
+
return 'ValidatorMessage';
|
|
11
|
+
}
|
|
12
|
+
constructor(buffer) {
|
|
13
|
+
const name = 'validator-message';
|
|
14
|
+
super(buffer, proto, { name });
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export { ValidatorMessage as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as BlockMessage } from './messages/block.js';
|
|
2
|
-
export { default as BWMessage } from './messages/bw.js';
|
|
3
|
-
export { default as BWRequestMessage } from './messages/bw-request.js';
|
|
4
|
-
export { default as ContractMessage } from './messages/contract.js';
|
|
5
|
-
export { default as LastBlockMessage } from './messages/last-block.js';
|
|
6
|
-
export { default as LastBlockRequestMessage } from './messages/last-block-request.js';
|
|
7
|
-
export { default as TransactionMessage } from './messages/transaction.js';
|
|
8
|
-
export { default as ValidatorMessage } from './messages/validator.js';
|
|
1
|
+
export { default as BlockMessage } from './messages/block.js';
|
|
2
|
+
export { default as BWMessage } from './messages/bw.js';
|
|
3
|
+
export { default as BWRequestMessage } from './messages/bw-request.js';
|
|
4
|
+
export { default as ContractMessage } from './messages/contract.js';
|
|
5
|
+
export { default as LastBlockMessage } from './messages/last-block.js';
|
|
6
|
+
export { default as LastBlockRequestMessage } from './messages/last-block-request.js';
|
|
7
|
+
export { default as TransactionMessage } from './messages/transaction.js';
|
|
8
|
+
export { default as ValidatorMessage } from './messages/validator.js';
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class BlockMessage extends FormatInterface {
|
|
3
|
-
decoded: {
|
|
4
|
-
index: Number;
|
|
5
|
-
previousHash: String;
|
|
6
|
-
timestamp: String;
|
|
7
|
-
reward: Number;
|
|
8
|
-
fees: Number;
|
|
9
|
-
transactions: Uint8Array[] | Object[] | Uint8Array;
|
|
10
|
-
validators: Uint8Array[] | Object[] | Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
get messageName(): string;
|
|
13
|
-
constructor(buffer: messageInput);
|
|
14
|
-
encode(): Uint8Array;
|
|
15
|
-
decode(): {
|
|
16
|
-
index: Number;
|
|
17
|
-
previousHash: String;
|
|
18
|
-
timestamp: String;
|
|
19
|
-
reward: Number;
|
|
20
|
-
fees: Number;
|
|
21
|
-
transactions: Uint8Array | Uint8Array[] | Object[];
|
|
22
|
-
validators: Uint8Array | Uint8Array[] | Object[];
|
|
23
|
-
};
|
|
24
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class BlockMessage extends FormatInterface {
|
|
3
|
+
decoded: {
|
|
4
|
+
index: Number;
|
|
5
|
+
previousHash: String;
|
|
6
|
+
timestamp: String;
|
|
7
|
+
reward: Number;
|
|
8
|
+
fees: Number;
|
|
9
|
+
transactions: Uint8Array[] | Object[] | Uint8Array;
|
|
10
|
+
validators: Uint8Array[] | Object[] | Uint8Array;
|
|
11
|
+
};
|
|
12
|
+
get messageName(): string;
|
|
13
|
+
constructor(buffer: messageInput);
|
|
14
|
+
encode(): Uint8Array;
|
|
15
|
+
decode(): {
|
|
16
|
+
index: Number;
|
|
17
|
+
previousHash: String;
|
|
18
|
+
timestamp: String;
|
|
19
|
+
reward: Number;
|
|
20
|
+
fees: Number;
|
|
21
|
+
transactions: Uint8Array | Uint8Array[] | Object[];
|
|
22
|
+
validators: Uint8Array | Uint8Array[] | Object[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class BWRequestMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class BWRequestMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class BWMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class BWMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class ContractMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class ContractMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class LastBlockRequestMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class LastBlockRequestMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class LastBlockMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class LastBlockMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class BWRequestMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class BWRequestMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class TransactionMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class TransactionMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
-
export default class ValidatorMessage extends FormatInterface {
|
|
3
|
-
get messageName(): string;
|
|
4
|
-
constructor(buffer: messageInput);
|
|
5
|
-
}
|
|
1
|
+
import { FormatInterface } from '@leofcoin/codec-format-interface';
|
|
2
|
+
export default class ValidatorMessage extends FormatInterface {
|
|
3
|
+
get messageName(): string;
|
|
4
|
+
constructor(buffer: messageInput);
|
|
5
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const index: number;
|
|
3
|
-
const previousHash: string;
|
|
4
|
-
const timestamp: number;
|
|
5
|
-
const reward:
|
|
6
|
-
const fees:
|
|
7
|
-
const transactions: Uint8Array;
|
|
8
|
-
const validators: Uint8Array;
|
|
9
|
-
}
|
|
10
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const index: number;
|
|
3
|
+
const previousHash: string;
|
|
4
|
+
const timestamp: number;
|
|
5
|
+
const reward: any;
|
|
6
|
+
const fees: any;
|
|
7
|
+
const transactions: Uint8Array;
|
|
8
|
+
const validators: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: {};
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const up: number;
|
|
3
|
-
const down: number;
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const up: number;
|
|
3
|
+
const down: number;
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const creator: string;
|
|
3
|
-
const contract: Uint8Array;
|
|
4
|
-
const constructorParameters: any[];
|
|
5
|
-
}
|
|
6
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const creator: string;
|
|
3
|
+
const contract: Uint8Array;
|
|
4
|
+
const constructorParameters: any[];
|
|
5
|
+
}
|
|
6
|
+
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: {};
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: {};
|
|
2
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const hash: string;
|
|
3
|
-
const index: number;
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const hash: string;
|
|
3
|
+
const index: number;
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const name: string;
|
|
3
|
-
const version: number;
|
|
4
|
-
const publisher: string;
|
|
5
|
-
const entry: string;
|
|
6
|
-
const files: Uint8Array;
|
|
7
|
-
}
|
|
8
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const name: string;
|
|
3
|
+
const version: number;
|
|
4
|
+
const publisher: string;
|
|
5
|
+
const entry: string;
|
|
6
|
+
const files: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
export default _default;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const timestamp: number;
|
|
3
|
-
const from: string;
|
|
4
|
-
const to: string;
|
|
5
|
-
const nonce: number;
|
|
6
|
-
const method: string;
|
|
7
|
-
const params: any[];
|
|
8
|
-
const signature: Uint8Array;
|
|
9
|
-
}
|
|
10
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const timestamp: number;
|
|
3
|
+
const from: string;
|
|
4
|
+
const to: string;
|
|
5
|
+
const nonce: number;
|
|
6
|
+
const method: string;
|
|
7
|
+
const params: any[];
|
|
8
|
+
const signature: Uint8Array;
|
|
9
|
+
}
|
|
10
|
+
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare namespace _default {
|
|
2
|
-
const address: string;
|
|
3
|
-
const reward: number;
|
|
4
|
-
}
|
|
5
|
-
export default _default;
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const address: string;
|
|
3
|
+
const reward: number;
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
@@ -8,16 +8,16 @@ import TransactionMessage from '../messages/transaction.js';
|
|
|
8
8
|
import '../messages/validator.js';
|
|
9
9
|
import EasyWorker from '@vandeurenglenn/easy-worker';
|
|
10
10
|
|
|
11
|
-
globalThis.peernet = globalThis.peernet || {};
|
|
12
|
-
globalThis.contracts = {};
|
|
13
|
-
const worker = new EasyWorker();
|
|
14
|
-
worker.onmessage(async (transactions) => {
|
|
15
|
-
globalThis.peernet.codecs = {
|
|
16
|
-
'transaction-message': {
|
|
17
|
-
codec: parseInt('746d', 16),
|
|
18
|
-
hashAlg: 'keccak-256'
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
transactions = await Promise.all(transactions.map(async (message) => (message instanceof TransactionMessage ? new Uint8Array(message.encoded) : new TransactionMessage({ ...message, signature: new Uint8Array(message.signature) }).encoded)));
|
|
22
|
-
worker.postMessage(transactions);
|
|
11
|
+
globalThis.peernet = globalThis.peernet || {};
|
|
12
|
+
globalThis.contracts = {};
|
|
13
|
+
const worker = new EasyWorker();
|
|
14
|
+
worker.onmessage(async (transactions) => {
|
|
15
|
+
globalThis.peernet.codecs = {
|
|
16
|
+
'transaction-message': {
|
|
17
|
+
codec: parseInt('746d', 16),
|
|
18
|
+
hashAlg: 'keccak-256'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
transactions = await Promise.all(transactions.map(async (message) => (message instanceof TransactionMessage ? new Uint8Array(message.encoded) : new TransactionMessage({ ...message, signature: new Uint8Array(message.signature) }).encoded)));
|
|
22
|
+
worker.postMessage(transactions);
|
|
23
23
|
});
|