@leofcoin/chain 1.8.14 → 1.8.15
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/browser/chain.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as toBase58, T as TransactionMessage, C as ContractMessage, R as RawTransactionMessage, B as BlockMessage, P as PROTOCOL_VERSION, a as REACHED_ONE_ZERO_ZERO, b as BWMessage, c as BWRequestMessage } from './constants-
|
|
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';
|
|
2
2
|
import { log } from 'console';
|
|
3
3
|
import { log as log$1 } from 'node:console';
|
|
4
4
|
|
|
@@ -5107,7 +5107,7 @@ class State extends Contract {
|
|
|
5107
5107
|
};
|
|
5108
5108
|
this.#lastBlockHandler = async () => {
|
|
5109
5109
|
return new globalThis.peernet.protos['peernet-response']({
|
|
5110
|
-
response: await this.lastBlock
|
|
5110
|
+
response: new Uint8Array(new LastBlockMessage(await this.lastBlock).encoded)
|
|
5111
5111
|
});
|
|
5112
5112
|
};
|
|
5113
5113
|
this.#knownBlocksHandler = async () => {
|
|
@@ -6016,7 +6016,7 @@ class ConnectionMonitor {
|
|
|
6016
6016
|
const networkName = globalThis.peernet?.network;
|
|
6017
6017
|
if (networkName && typeof networkName === 'string') {
|
|
6018
6018
|
// Try to import network config
|
|
6019
|
-
const { default: networks } = await import('./constants-
|
|
6019
|
+
const { default: networks } = await import('./constants-BKKQytjd.js').then(function (n) { return n.n; });
|
|
6020
6020
|
const [mainKey, subKey] = networkName.split(':');
|
|
6021
6021
|
const networkConfig = networks?.[mainKey]?.[subKey];
|
|
6022
6022
|
if (networkConfig?.stars && Array.isArray(networkConfig.stars)) {
|
|
@@ -6114,6 +6114,16 @@ class ConnectionMonitor {
|
|
|
6114
6114
|
}
|
|
6115
6115
|
}
|
|
6116
6116
|
|
|
6117
|
+
utils.addCodec({
|
|
6118
|
+
name: 'last-block-message',
|
|
6119
|
+
codec: 0x6c626d,
|
|
6120
|
+
hashAlg: 'keccak-256'
|
|
6121
|
+
});
|
|
6122
|
+
utils.addCodec({
|
|
6123
|
+
name: 'last-block-request-message',
|
|
6124
|
+
codec: 0x6c62726d,
|
|
6125
|
+
hashAlg: 'keccak-256'
|
|
6126
|
+
});
|
|
6117
6127
|
const debug = createDebugger('leofcoin/chain');
|
|
6118
6128
|
// check if browser or local
|
|
6119
6129
|
class Chain extends VersionControl {
|
|
@@ -6344,7 +6354,7 @@ class Chain extends VersionControl {
|
|
|
6344
6354
|
}
|
|
6345
6355
|
let lastBlock;
|
|
6346
6356
|
try {
|
|
6347
|
-
lastBlock = await this.#makeRequest(peer, 'lastBlock');
|
|
6357
|
+
lastBlock = new LastBlockMessage(await this.#makeRequest(peer, 'lastBlock')).decoded;
|
|
6348
6358
|
}
|
|
6349
6359
|
catch (error) {
|
|
6350
6360
|
const peerName = peer?.peerId || peer?.id || peer?.address || peerId || 'unknown';
|