@leofcoin/messages 1.3.2 → 1.3.3
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 +2 -2
- package/test.js +7 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/messages",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./exports/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tslib": "^2.4.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@leofcoin/codec-format-interface": "^1.
|
|
30
|
+
"@leofcoin/codec-format-interface": "^1.6.5",
|
|
31
31
|
"@vandeurenglenn/easy-worker": "^1.0.2"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/test.js
CHANGED
|
@@ -1,37 +1,8 @@
|
|
|
1
1
|
import BlockMessage from "./exports/messages/block.js";
|
|
2
2
|
import BWRequestMessage from "./exports/messages/bw-request.js";
|
|
3
3
|
import { ContractMessage } from "./exports/index.js";
|
|
4
|
-
globalThis.peernet = globalThis.peernet || {}
|
|
5
|
-
peernet.codecs = {
|
|
6
|
-
'contract-message': {
|
|
7
|
-
codec: parseInt('63636d', 16),
|
|
8
|
-
hashAlg: 'keccak-256'
|
|
9
|
-
},
|
|
10
|
-
'transaction-message': {
|
|
11
|
-
codec: parseInt('746d', 16),
|
|
12
|
-
hashAlg: 'keccak-256'
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
'block-message': {
|
|
16
|
-
codec: parseInt('626d', 16),
|
|
17
|
-
hashAlg: 'keccak-256'
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
'bw-message': {
|
|
21
|
-
codec: parseInt('62776d', 16),
|
|
22
|
-
hashAlg: 'keccak-256'
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
'bw-request-message': {
|
|
26
|
-
codec: parseInt('6277726d', 16),
|
|
27
|
-
hashAlg: 'keccak-256'
|
|
28
|
-
},
|
|
29
|
-
'validator-message': {
|
|
30
|
-
codec: parseInt('766d', 16),
|
|
31
|
-
hashAlg: 'keccak-256'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
4
|
|
|
5
|
+
console.log(globalThis.peernet);
|
|
35
6
|
// globalThis.peernet.codecs
|
|
36
7
|
const validators = [{
|
|
37
8
|
address: 'address',
|
|
@@ -39,7 +10,7 @@ const validators = [{
|
|
|
39
10
|
}]
|
|
40
11
|
|
|
41
12
|
const transactions = []
|
|
42
|
-
for (let i = 0; i <=
|
|
13
|
+
for (let i = 0; i <= 1_235; i++) {
|
|
43
14
|
transactions.push(
|
|
44
15
|
{
|
|
45
16
|
timestamp: new Date().getTime(),
|
|
@@ -67,7 +38,7 @@ const contractMessage = new ContractMessage({
|
|
|
67
38
|
contract: new Uint8Array(),
|
|
68
39
|
constructorParameters: []
|
|
69
40
|
})
|
|
70
|
-
|
|
41
|
+
console.log({contractMessage});
|
|
71
42
|
const bw = new BWRequestMessage()
|
|
72
43
|
|
|
73
44
|
const message = new BlockMessage(block)
|
|
@@ -80,4 +51,7 @@ console.timeEnd('normal encoded')
|
|
|
80
51
|
|
|
81
52
|
console.log('# is smaller then normal encoded');
|
|
82
53
|
console.info(`normal: ${normalEncoded.length}\nmessage: ${message.encoded.length}`);
|
|
83
|
-
console.log(normalEncoded.length > message.encoded.length);
|
|
54
|
+
console.log(normalEncoded.length > message.encoded.length);
|
|
55
|
+
|
|
56
|
+
const contract = new ContractMessage('237,198,141,3,53,89,84,113,120,75,115,104,87,72,52,81,111,55,75,112,114,71,89,120,81,86,67,78,89,117,116,101,100,97,69,54,89,71,111,85,100,85,80,110,85,100,70,85,86,66,80,114,84,122,103,115,114,80,238,4,99,108,97,115,115,32,70,97,99,116,111,114,121,123,35,110,97,109,101,61,34,65,114,116,79,110,108,105,110,101,67,111,110,116,114,97,99,116,70,97,99,116,111,114,121,34,59,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,48,59,35,99,111,110,116,114,97,99,116,115,61,91,93,59,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,116,97,116,101,38,38,40,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,99,111,110,116,114,97,99,116,115,44,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,116,111,116,97,108,67,111,110,116,114,97,99,116,115,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,116,111,116,97,108,67,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,44,99,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,125,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,99,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,91,46,46,46,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,93,125,103,101,116,32,116,111,116,97,108,67,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,125,97,115,121,110,99,32,114,101,103,105,115,116,101,114,67,111,110,116,114,97,99,116,40,97,100,100,114,101,115,115,41,123,105,102,40,97,119,97,105,116,32,109,115,103,46,115,116,97,116,105,99,67,97,108,108,40,97,100,100,114,101,115,115,44,34,104,97,115,82,111,108,101,34,44,91,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,93,41,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,108,114,101,97,100,121,32,114,101,103,105,115,116,101,114,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,43,61,49,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,125,114,101,116,117,114,110,32,70,97,99,116,111,114,121,59,2,91,93')
|
|
57
|
+
console.log(contract);
|