univo 0.2.3 → 0.2.4

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
@@ -5,7 +5,7 @@ import { config } from 'dotenv';
5
5
  import { WebSocket } from 'partysocket';
6
6
  import { defineCommand, runMain } from 'citty';
7
7
  import { http } from './transport.mjs';
8
- import { c as createLogger, v as version, f as name } from './shared/univo.CKcWHEHI.mjs';
8
+ import { c as createLogger, v as version, f as name } from './shared/univo.6U84KZUp.mjs';
9
9
  import './shared/univo.C0flyVee.mjs';
10
10
 
11
11
  const log = createLogger({ quiet: false });
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createLogger, d as decompress, a as decoder, h as hexToNumber, i as isHexEqual, r as retry, v as version, n as nonNullable } from './shared/univo.CKcWHEHI.mjs';
1
+ import { c as createLogger, d as decompress, a as decoder, h as hexToNumber, i as isHexEqual, r as retry, v as version, n as nonNullable } from './shared/univo.6U84KZUp.mjs';
2
2
  import { c as createException, g as getException, a as catchException } from './shared/univo.C0flyVee.mjs';
3
3
 
4
4
  function matchFilter(block, filter) {
@@ -119,15 +119,20 @@ function indexer(opts) {
119
119
  return block;
120
120
  }
121
121
  const public_getFinalizedHeight = async (chain) => {
122
- const [stored] = await metadata.blocks.get({ chain });
123
- if (stored !== void 0) {
124
- return hexToNumber(stored.eth_getBlockByNumber.number) - 1;
125
- }
126
- const finalized = await getBlock({ chain, number: "finalized" });
122
+ const [finalized, [stored]] = await Promise.all([
123
+ getBlock({ chain, number: "finalized" }),
124
+ //
125
+ metadata.blocks.get({ chain })
126
+ ]);
127
127
  if (finalized === null) {
128
128
  throw new Error("Failed to determine unfinalized height");
129
129
  }
130
- return hexToNumber(finalized.eth_getBlockByNumber.number);
130
+ const finalizedHeight = hexToNumber(finalized.eth_getBlockByNumber.number);
131
+ if (stored === void 0) {
132
+ return finalizedHeight;
133
+ }
134
+ const storedHeight = hexToNumber(stored.eth_getBlockByNumber.number) - 1;
135
+ return Math.min(finalizedHeight, storedHeight);
131
136
  };
132
137
  const public_writeUnfinalizedHeads = async (heads) => {
133
138
  let chain = void 0;
package/dist/realtime.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as createLogger, b as iife, h as hexToNumber, e as numberToHex, m as mutex, r as retry, i as isHexEqual } from './shared/univo.CKcWHEHI.mjs';
1
+ import { c as createLogger, b as iife, h as hexToNumber, e as numberToHex, m as mutex, r as retry, i as isHexEqual } from './shared/univo.6U84KZUp.mjs';
2
2
 
3
3
  const MAX_LENGTH = 1e4;
4
4
  function defineBlockchain(opts) {
@@ -1,5 +1,5 @@
1
1
  const name = "univo";
2
- const version = "0.2.3";
2
+ const version = "0.2.4";
3
3
 
4
4
  function createLogger(opts) {
5
5
  return {
@@ -1,7 +1,7 @@
1
1
  import ws from 'ws';
2
2
  import { WebSocket } from 'partysocket';
3
3
  import { c as createException } from './shared/univo.C0flyVee.mjs';
4
- import { g as compress, j as raise, c as createLogger } from './shared/univo.CKcWHEHI.mjs';
4
+ import { g as compress, j as raise, c as createLogger } from './shared/univo.6U84KZUp.mjs';
5
5
 
6
6
  function createSocket(url, opts) {
7
7
  const socket = new WebSocket(url, [], { WebSocket: ws });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "univo",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "0.2.3",
5
+ "version": "0.2.4",
6
6
  "sideEffects": false,
7
7
  "module": "./dist/index.mjs",
8
8
  "types": "./dist/index.d.ts",