univo 0.2.22 → 0.2.23
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/dist/cli.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import open from 'open';
|
|
|
4
4
|
import { config } from 'dotenv';
|
|
5
5
|
import { WebSocket } from 'partysocket';
|
|
6
6
|
import { defineCommand, runMain } from 'citty';
|
|
7
|
-
import { h as http } from './shared/univo.
|
|
8
|
-
import { c as createLogger, v as version, b as name } from './shared/univo.
|
|
7
|
+
import { h as http } from './shared/univo.1clH0g-n.mjs';
|
|
8
|
+
import { c as createLogger, v as version, b as name } from './shared/univo.DvxWs2zB.mjs';
|
|
9
9
|
|
|
10
10
|
const log = createLogger({ quiet: false });
|
|
11
11
|
const dev = defineCommand({
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StorageError } from '@storagesdk/core';
|
|
2
|
-
import { g as getException, c as createException, a as catchException, l as local } from './shared/univo.
|
|
3
|
-
import { c as createLogger, d as decompress, e as decoder, r as retry, v as version, h as hexToNumber, a as isHexEqual, n as numberToHex, f as normalizeHex, g as compress } from './shared/univo.
|
|
2
|
+
import { g as getException, c as createException, a as catchException, l as local } from './shared/univo.1clH0g-n.mjs';
|
|
3
|
+
import { c as createLogger, d as decompress, e as decoder, r as retry, v as version, h as hexToNumber, a as isHexEqual, n as numberToHex, f as normalizeHex, g as compress } from './shared/univo.DvxWs2zB.mjs';
|
|
4
4
|
import 'ws';
|
|
5
5
|
import 'partysocket';
|
|
6
6
|
|
|
@@ -498,20 +498,22 @@ function indexer(opts) {
|
|
|
498
498
|
throw new Error("Client has stalled. Chain has finalized greater than the heads received");
|
|
499
499
|
}
|
|
500
500
|
log.debug(`Indexer height ${indexerHeight}, finalized height ${finalizedHeight}`);
|
|
501
|
-
if (indexerHeight === finalizedHeight) {
|
|
502
|
-
log.debug("No heads to finalize, returning...");
|
|
503
|
-
return await cleanupFinalizedHeads(chain, numberToHex(finalizedHeight));
|
|
504
|
-
}
|
|
505
501
|
const newHeads = heads.filter((head) => {
|
|
506
502
|
return hexToNumber(head.number) > indexerHeight;
|
|
507
503
|
});
|
|
508
504
|
const [firstNewHead] = newHeads;
|
|
505
|
+
if (firstNewHead === void 0 && indexerHeight === finalizedHeight) {
|
|
506
|
+
return log.debug("No heads to finalize, returning...");
|
|
507
|
+
}
|
|
509
508
|
if (firstNewHead === void 0) {
|
|
510
|
-
throw new Error("Internal error. Expected at least one head greater than the indexer height.");
|
|
509
|
+
throw new Error("Internal error. Expected at least one head greater than the indexer height and less than the finalized height.");
|
|
511
510
|
}
|
|
512
511
|
if (hexToNumber(firstNewHead.number) !== indexerHeight + 1) {
|
|
513
512
|
throw new Error("Client advanced too far. Heads received are greater than the first new head");
|
|
514
513
|
}
|
|
514
|
+
if (heights.length > 1) {
|
|
515
|
+
await cleanupFinalizedHeads(chain, numberToHex(indexerHeight));
|
|
516
|
+
}
|
|
515
517
|
for (const head of newHeads) {
|
|
516
518
|
await Promise.all([
|
|
517
519
|
processEventsForCanonicalHead(head),
|
package/dist/realtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createLogger, i as iife, h as hexToNumber, n as numberToHex, m as mutex, r as retry, a as isHexEqual } from './shared/univo.
|
|
1
|
+
import { c as createLogger, i as iife, h as hexToNumber, n as numberToHex, m as mutex, r as retry, a as isHexEqual } from './shared/univo.DvxWs2zB.mjs';
|
|
2
2
|
|
|
3
3
|
function defineBlockchain(opts) {
|
|
4
4
|
const log = createLogger({ quiet: opts.quiet });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ws from 'ws';
|
|
2
2
|
import { WebSocket } from 'partysocket';
|
|
3
|
-
import { g as compress, j as raise, c as createLogger, m as mutex } from './univo.
|
|
3
|
+
import { g as compress, j as raise, c as createLogger, m as mutex } from './univo.DvxWs2zB.mjs';
|
|
4
4
|
|
|
5
5
|
function createException(message) {
|
|
6
6
|
return `univo:${message}`;
|
|
@@ -26,20 +26,11 @@ const DEFAULT_TIMEOUT_MS = 60 * 1e3;
|
|
|
26
26
|
const UnknownMethodError = createException("The requested RPC method does not exist on the provided implementation");
|
|
27
27
|
function local(rpc) {
|
|
28
28
|
const request = async (opts) => {
|
|
29
|
-
const signal = opts.signal ?? AbortSignal.timeout(DEFAULT_TIMEOUT_MS);
|
|
30
|
-
if (signal.aborted) {
|
|
31
|
-
throw signal.reason;
|
|
32
|
-
}
|
|
33
29
|
const method = rpc.request[opts.method];
|
|
34
30
|
if (method === void 0) {
|
|
35
31
|
throw new Error(UnknownMethodError);
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
return await new Promise((resolve, reject) => {
|
|
39
|
-
const abort = () => reject(signal.reason);
|
|
40
|
-
signal.addEventListener("abort", abort, { once: true });
|
|
41
|
-
Promise.resolve(result).then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
|
|
42
|
-
});
|
|
33
|
+
return await method(...opts.params);
|
|
43
34
|
};
|
|
44
35
|
const subscribe = async () => {
|
|
45
36
|
throw new Error("Unable to `subscribe` on `local` transport");
|
package/dist/transport.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'ws';
|
|
2
2
|
import 'partysocket';
|
|
3
|
-
export { h as http, l as local, w as wss } from './shared/univo.
|
|
4
|
-
import './shared/univo.
|
|
3
|
+
export { h as http, l as local, w as wss } from './shared/univo.1clH0g-n.mjs';
|
|
4
|
+
import './shared/univo.DvxWs2zB.mjs';
|