@leofcoin/chain 1.9.19 → 1.9.20
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 +4 -1
- package/exports/chain.js +4 -1
- package/package.json +1 -1
package/exports/browser/chain.js
CHANGED
|
@@ -6381,6 +6381,7 @@ class Chain extends VersionControl {
|
|
|
6381
6381
|
const node = await this.#prepareRequest(request);
|
|
6382
6382
|
try {
|
|
6383
6383
|
let response = await peer.request(node.encoded);
|
|
6384
|
+
console.log(`raw response for request ${request}:`, response);
|
|
6384
6385
|
if (response === void 0 || response === null) return response;
|
|
6385
6386
|
const normalizeResponse = async (payload) => {
|
|
6386
6387
|
if (payload === void 0 || payload === null) return payload;
|
|
@@ -6397,7 +6398,7 @@ class Chain extends VersionControl {
|
|
|
6397
6398
|
try {
|
|
6398
6399
|
const wrapped = await new globalThis.peernet.protos["peernet-response"](bytes);
|
|
6399
6400
|
if (wrapped?.decoded?.response !== void 0) {
|
|
6400
|
-
return
|
|
6401
|
+
return wrapped.decoded.response;
|
|
6401
6402
|
}
|
|
6402
6403
|
} catch {
|
|
6403
6404
|
}
|
|
@@ -6472,6 +6473,7 @@ class Chain extends VersionControl {
|
|
|
6472
6473
|
}
|
|
6473
6474
|
async getPeerTransactionPool(peer) {
|
|
6474
6475
|
let transactionsInPool = await this.#makeRequest(peer, "transactionPool");
|
|
6476
|
+
console.log("raw response for request transactionPool:", transactionsInPool);
|
|
6475
6477
|
if (transactionsInPool instanceof Uint8Array) {
|
|
6476
6478
|
debug("transactionPool response must be decoded array payload");
|
|
6477
6479
|
return [];
|
|
@@ -6535,6 +6537,7 @@ class Chain extends VersionControl {
|
|
|
6535
6537
|
console.log("requesting last block from peer...");
|
|
6536
6538
|
console.log(await this.lastBlock);
|
|
6537
6539
|
const lastBlockRaw = await this.#makeRequest(peer, "lastBlock");
|
|
6540
|
+
console.log("raw last block response:", lastBlockRaw);
|
|
6538
6541
|
if (lastBlockRaw === void 0 || lastBlockRaw === null || typeof lastBlockRaw !== "object" && !(lastBlockRaw instanceof Uint8Array)) {
|
|
6539
6542
|
throw new Error(`invalid lastBlock payload: ${typeof lastBlockRaw}`);
|
|
6540
6543
|
}
|
package/exports/chain.js
CHANGED
|
@@ -2587,6 +2587,7 @@ class Chain extends VersionControl {
|
|
|
2587
2587
|
const node = await this.#prepareRequest(request);
|
|
2588
2588
|
try {
|
|
2589
2589
|
let response = await peer.request(node.encoded);
|
|
2590
|
+
console.log(`raw response for request ${request}:`, response);
|
|
2590
2591
|
if (response === void 0 || response === null) return response;
|
|
2591
2592
|
const normalizeResponse = async (payload) => {
|
|
2592
2593
|
if (payload === void 0 || payload === null) return payload;
|
|
@@ -2603,7 +2604,7 @@ class Chain extends VersionControl {
|
|
|
2603
2604
|
try {
|
|
2604
2605
|
const wrapped = await new globalThis.peernet.protos["peernet-response"](bytes);
|
|
2605
2606
|
if (wrapped?.decoded?.response !== void 0) {
|
|
2606
|
-
return
|
|
2607
|
+
return wrapped.decoded.response;
|
|
2607
2608
|
}
|
|
2608
2609
|
} catch {
|
|
2609
2610
|
}
|
|
@@ -2678,6 +2679,7 @@ class Chain extends VersionControl {
|
|
|
2678
2679
|
}
|
|
2679
2680
|
async getPeerTransactionPool(peer) {
|
|
2680
2681
|
let transactionsInPool = await this.#makeRequest(peer, "transactionPool");
|
|
2682
|
+
console.log("raw response for request transactionPool:", transactionsInPool);
|
|
2681
2683
|
if (transactionsInPool instanceof Uint8Array) {
|
|
2682
2684
|
debug("transactionPool response must be decoded array payload");
|
|
2683
2685
|
return [];
|
|
@@ -2741,6 +2743,7 @@ class Chain extends VersionControl {
|
|
|
2741
2743
|
console.log("requesting last block from peer...");
|
|
2742
2744
|
console.log(await this.lastBlock);
|
|
2743
2745
|
const lastBlockRaw = await this.#makeRequest(peer, "lastBlock");
|
|
2746
|
+
console.log("raw last block response:", lastBlockRaw);
|
|
2744
2747
|
if (lastBlockRaw === void 0 || lastBlockRaw === null || typeof lastBlockRaw !== "object" && !(lastBlockRaw instanceof Uint8Array)) {
|
|
2745
2748
|
throw new Error(`invalid lastBlock payload: ${typeof lastBlockRaw}`);
|
|
2746
2749
|
}
|