@leofcoin/chain 1.8.15 → 1.8.16

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.
@@ -1,4 +1,4 @@
1
- import { t as toBase58, T as TransactionMessage, C as ContractMessage, R as RawTransactionMessage, B as BlockMessage, L as LastBlockMessage, P as PROTOCOL_VERSION, a as REACHED_ONE_ZERO_ZERO, u as utils, b as BWMessage, c as BWRequestMessage } from './constants-BKKQytjd.js';
1
+ import { t as toBase58, T as TransactionMessage, C as ContractMessage, R as RawTransactionMessage, B as BlockMessage, u as utils, L as LastBlockMessage, P as PROTOCOL_VERSION, a as REACHED_ONE_ZERO_ZERO, b as BWMessage, c as BWRequestMessage } from './constants-BKKQytjd.js';
2
2
  import { log } from 'console';
3
3
  import { log as log$1 } from 'node:console';
4
4
 
@@ -4994,6 +4994,11 @@ class Jobber {
4994
4994
  }
4995
4995
  }
4996
4996
 
4997
+ utils.addCodec({
4998
+ name: 'last-block-message',
4999
+ codec: 0x6c626d,
5000
+ hashAlg: 'keccak-256'
5001
+ });
4997
5002
  const debug$1 = createDebugger('leofcoin/state');
4998
5003
  class State extends Contract {
4999
5004
  #resolveErrored;
@@ -5107,7 +5112,7 @@ class State extends Contract {
5107
5112
  };
5108
5113
  this.#lastBlockHandler = async () => {
5109
5114
  return new globalThis.peernet.protos['peernet-response']({
5110
- response: new Uint8Array(new LastBlockMessage(await this.lastBlock).encoded)
5115
+ response: new LastBlockMessage(await this.lastBlock).encoded
5111
5116
  });
5112
5117
  };
5113
5118
  this.#knownBlocksHandler = async () => {
@@ -6354,7 +6359,7 @@ class Chain extends VersionControl {
6354
6359
  }
6355
6360
  let lastBlock;
6356
6361
  try {
6357
- lastBlock = new LastBlockMessage(await this.#makeRequest(peer, 'lastBlock')).decoded;
6362
+ lastBlock = new LastBlockMessage(await this.#makeRequest(peer, 'lastBlock')).encoded;
6358
6363
  }
6359
6364
  catch (error) {
6360
6365
  const peerName = peer?.peerId || peer?.id || peer?.address || peerId || 'unknown';
package/exports/chain.js CHANGED
@@ -8,9 +8,9 @@ import { randombytes } from '@leofcoin/crypto';
8
8
  import EasyWorker from '@vandeurenglenn/easy-worker';
9
9
  import { ContractDeploymentError, ExecutionError, isResolveError, ResolveError, isExecutionError } from '@leofcoin/errors';
10
10
  import { log } from 'console';
11
+ import codecs from '@leofcoin/codecs/utils';
11
12
  import { P as PROTOCOL_VERSION, R as REACHED_ONE_ZERO_ZERO } from './constants-eo0U5-D_.js';
12
13
  import { log as log$1 } from 'node:console';
13
- import codecs from '@leofcoin/codecs/utils';
14
14
  import '@leofcoin/networks';
15
15
 
16
16
  const limit = 1800;
@@ -1135,6 +1135,11 @@ class Jobber {
1135
1135
  }
1136
1136
  }
1137
1137
 
1138
+ codecs.addCodec({
1139
+ name: 'last-block-message',
1140
+ codec: 0x6c626d,
1141
+ hashAlg: 'keccak-256'
1142
+ });
1138
1143
  const debug$1 = createDebugger('leofcoin/state');
1139
1144
  class State extends Contract {
1140
1145
  #resolveErrored;
@@ -1248,7 +1253,7 @@ class State extends Contract {
1248
1253
  };
1249
1254
  this.#lastBlockHandler = async () => {
1250
1255
  return new globalThis.peernet.protos['peernet-response']({
1251
- response: new Uint8Array(new LastBlockMessage(await this.lastBlock).encoded)
1256
+ response: new LastBlockMessage(await this.lastBlock).encoded
1252
1257
  });
1253
1258
  };
1254
1259
  this.#knownBlocksHandler = async () => {
@@ -2495,7 +2500,7 @@ class Chain extends VersionControl {
2495
2500
  }
2496
2501
  let lastBlock;
2497
2502
  try {
2498
- lastBlock = new LastBlockMessage(await this.#makeRequest(peer, 'lastBlock')).decoded;
2503
+ lastBlock = new LastBlockMessage(await this.#makeRequest(peer, 'lastBlock')).encoded;
2499
2504
  }
2500
2505
  catch (error) {
2501
2506
  const peerName = peer?.peerId || peer?.id || peer?.address || peerId || 'unknown';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.8.15",
3
+ "version": "1.8.16",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {