univo 0.4.1 → 0.4.3
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 +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +149 -46
- package/dist/proxy.d.mts +1 -1
- package/dist/proxy.d.ts +1 -1
- package/dist/proxy.mjs +40 -54
- package/dist/realtime.d.mts +1 -1
- package/dist/realtime.d.ts +1 -1
- package/dist/realtime.mjs +2 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/shared/{univo.CNIJRI7c.d.ts → univo.7S1OTdpc.d.ts} +3 -15
- package/dist/shared/{univo.BcZ0twA5.d.mts → univo.Ckj3I8tQ.d.mts} +3 -15
- package/dist/shared/{univo.DD1x3F1G.mjs → univo.DEUuEEoe.mjs} +2 -2
- package/dist/transport.d.mts +1 -1
- package/dist/transport.d.ts +1 -1
- package/dist/transport.mjs +1 -1
- package/package.json +1 -1
- package/dist/shared/univo.C0flyVee.mjs +0 -21
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,
|
|
8
|
+
import { c as createLogger, v as version, n as name } from './shared/univo.DEUuEEoe.mjs';
|
|
9
9
|
|
|
10
10
|
const log = createLogger({ quiet: false });
|
|
11
11
|
const dev = defineCommand({
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Action, B as Block, E as Event, F as Filter, H as Head, e as Indexer, f as PrivateMetadata, P as PublicMetadata, g as Result, c as defineAction, a as defineEvent, d as defineIndexer } from './shared/univo.
|
|
1
|
+
export { A as Action, B as Block, E as Event, F as Filter, H as Head, e as Indexer, f as PrivateMetadata, P as PublicMetadata, g as Result, c as defineAction, a as defineEvent, d as defineIndexer } from './shared/univo.Ckj3I8tQ.mjs';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './metadata.mjs';
|
|
4
4
|
import './metadata/adapters.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Action, B as Block, E as Event, F as Filter, H as Head, e as Indexer, f as PrivateMetadata, P as PublicMetadata, g as Result, c as defineAction, a as defineEvent, d as defineIndexer } from './shared/univo.
|
|
1
|
+
export { A as Action, B as Block, E as Event, F as Filter, H as Head, e as Indexer, f as PrivateMetadata, P as PublicMetadata, g as Result, c as defineAction, a as defineEvent, d as defineIndexer } from './shared/univo.7S1OTdpc.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './metadata.js';
|
|
4
4
|
import './metadata/adapters.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,50 +1,122 @@
|
|
|
1
|
-
import { hexToNumber, numberToHex, hexToBytes, keccak256, toRlp, hexToBigInt,
|
|
1
|
+
import { hexToNumber, numberToHex, hexToBytes, keccak256, toRlp, hexToBigInt, numberToBytes, isHex, concatBytes, concatHex, formatTransaction, serializeTransaction } from 'viem';
|
|
2
2
|
import { local } from './transport.mjs';
|
|
3
|
-
import { c as createLogger, r as retry, v as version,
|
|
3
|
+
import { c as createLogger, r as retry, v as version, d as normalizeHex, e as decompress, a as isHexEqual, b as compress, i as iife, f as decoder } from './shared/univo.DEUuEEoe.mjs';
|
|
4
4
|
import { AdapterError } from './metadata/adapters.mjs';
|
|
5
|
-
import { c as createException, a as catchException } from './shared/univo.C0flyVee.mjs';
|
|
6
5
|
import 'ws';
|
|
7
6
|
import 'partysocket';
|
|
8
7
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
if (!toBlockValid(block, filter)) return false;
|
|
12
|
-
if (!fromBlockValid(block, filter)) return false;
|
|
13
|
-
if (!includesLogEvent(block, filter)) return false;
|
|
14
|
-
if (!includesLogAddress(block, filter)) return false;
|
|
15
|
-
return true;
|
|
8
|
+
function createException(message) {
|
|
9
|
+
return `univo:${message}`;
|
|
16
10
|
}
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const fromBlockValid = (block, filter) => {
|
|
22
|
-
if (hexToNumber(block.eth_getBlockByNumber.number) >= filter.fromBlock) return true;
|
|
23
|
-
return false;
|
|
24
|
-
};
|
|
25
|
-
const toBlockValid = (block, filter) => {
|
|
26
|
-
if (filter.toBlock === void 0) return true;
|
|
27
|
-
if (hexToNumber(block.eth_getBlockByNumber.number) <= filter.toBlock) return true;
|
|
28
|
-
return false;
|
|
29
|
-
};
|
|
30
|
-
const includesLogAddress = (block, filter) => {
|
|
31
|
-
if (filter.address === void 0) return true;
|
|
32
|
-
for (const receipt of block.eth_getBlockReceipts) {
|
|
33
|
-
for (const log of receipt.logs) {
|
|
34
|
-
if (isHexEqual(log.address, filter.address)) return true;
|
|
11
|
+
function catchException(unknown, exception) {
|
|
12
|
+
if (unknown instanceof Error) {
|
|
13
|
+
if (unknown.message === exception) {
|
|
14
|
+
return true;
|
|
35
15
|
}
|
|
36
16
|
}
|
|
37
17
|
return false;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function matchFilter(block, filter) {
|
|
21
|
+
if (hexToNumber(block.eth_chainId) !== filter.chain) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (hexToNumber(block.eth_getBlockByNumber.number) < filter.fromBlock) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (typeof filter.toBlock === "number" && hexToNumber(block.eth_getBlockByNumber.number) > filter.toBlock) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (filter.address && filter.event && filter.function) {
|
|
31
|
+
const txs = [];
|
|
32
|
+
for (const tx of block.eth_getBlockByNumber.transactions) {
|
|
33
|
+
if (tx.to !== null && isHexEqual(tx.to, filter.address)) {
|
|
34
|
+
if (isHexEqual(tx.input.slice(0, 10), filter.function)) {
|
|
35
|
+
txs.push(tx.transactionIndex);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const receipt of block.eth_getBlockReceipts) {
|
|
40
|
+
for (const log of receipt.logs) {
|
|
41
|
+
if (log.topics[0] !== void 0 && isHexEqual(log.topics[0], filter.event)) {
|
|
42
|
+
if (isHexEqual(log.address, filter.address)) {
|
|
43
|
+
if (txs.some((tx) => isHexEqual(tx, log.transactionIndex))) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
44
49
|
}
|
|
50
|
+
return false;
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
if (filter.address && filter.event && filter.function === void 0) {
|
|
53
|
+
for (const receipt of block.eth_getBlockReceipts) {
|
|
54
|
+
for (const log of receipt.logs) {
|
|
55
|
+
if (log.topics[0] !== void 0 && isHexEqual(log.topics[0], filter.event)) {
|
|
56
|
+
if (isHexEqual(log.address, filter.address)) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (filter.address && filter.event === void 0 && filter.function) {
|
|
65
|
+
for (const tx of block.eth_getBlockByNumber.transactions) {
|
|
66
|
+
if (tx.to !== null && isHexEqual(tx.to, filter.address)) {
|
|
67
|
+
if (isHexEqual(tx.input.slice(0, 10), filter.function)) {
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (filter.address === void 0 && filter.event && filter.function) {
|
|
75
|
+
const txs = [];
|
|
76
|
+
for (const tx of block.eth_getBlockByNumber.transactions) {
|
|
77
|
+
if (tx.to !== null && isHexEqual(tx.input.slice(0, 10), filter.function)) {
|
|
78
|
+
txs.push(tx.transactionIndex);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (const receipt of block.eth_getBlockReceipts) {
|
|
82
|
+
for (const log of receipt.logs) {
|
|
83
|
+
if (log.topics[0] !== void 0 && isHexEqual(log.topics[0], filter.event)) {
|
|
84
|
+
if (txs.some((tx) => isHexEqual(tx, log.transactionIndex))) {
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (filter.address === void 0 && filter.event && filter.function === void 0) {
|
|
93
|
+
for (const receipt of block.eth_getBlockReceipts) {
|
|
94
|
+
for (const log of receipt.logs) {
|
|
95
|
+
if (log.topics[0] !== void 0 && isHexEqual(log.topics[0], filter.event)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (filter.address === void 0 && filter.event === void 0 && filter.function) {
|
|
103
|
+
for (const tx of block.eth_getBlockByNumber.transactions) {
|
|
104
|
+
if (tx.to !== null && isHexEqual(tx.input.slice(0, 10), filter.function)) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (filter.address && filter.event === void 0 && filter.function === void 0) {
|
|
111
|
+
for (const tx of block.eth_getBlockByNumber.transactions) {
|
|
112
|
+
if (isHexEqual(tx.from, filter.address) || tx.to !== null && isHexEqual(tx.to, filter.address)) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
48
120
|
function defineEvent(event) {
|
|
49
121
|
return event;
|
|
50
122
|
}
|
|
@@ -298,6 +370,45 @@ function defineIndexer(opts) {
|
|
|
298
370
|
const type = hexToBigInt(receipt.type);
|
|
299
371
|
return type === 0n ? encoded : concatBytes([Uint8Array.of(Number(type)), encoded]);
|
|
300
372
|
}
|
|
373
|
+
function serializeTransaction$1(tx) {
|
|
374
|
+
if (tx.type === "0x4") {
|
|
375
|
+
return concatHex([
|
|
376
|
+
"0x04",
|
|
377
|
+
toRlp([
|
|
378
|
+
quantityToBytes(tx.chainId),
|
|
379
|
+
quantityToBytes(tx.nonce),
|
|
380
|
+
quantityToBytes(tx.maxPriorityFeePerGas),
|
|
381
|
+
quantityToBytes(tx.maxFeePerGas),
|
|
382
|
+
quantityToBytes(tx.gas),
|
|
383
|
+
hexToBytes(tx.to),
|
|
384
|
+
quantityToBytes(tx.value),
|
|
385
|
+
hexToBytes(tx.input),
|
|
386
|
+
tx.accessList.map(({ address, storageKeys }) => [hexToBytes(address), storageKeys.map((key) => hexToBytes(key))]),
|
|
387
|
+
(tx.authorizationList ?? []).map((authorization) => [
|
|
388
|
+
quantityToBytes(authorization.chainId),
|
|
389
|
+
hexToBytes(authorization.address),
|
|
390
|
+
quantityToBytes(authorization.nonce),
|
|
391
|
+
quantityToBytes(authorization.yParity),
|
|
392
|
+
quantityToBytes(authorization.r),
|
|
393
|
+
quantityToBytes(authorization.s)
|
|
394
|
+
]),
|
|
395
|
+
quantityToBytes(tx.yParity ?? tx.v),
|
|
396
|
+
quantityToBytes(tx.r),
|
|
397
|
+
quantityToBytes(tx.s)
|
|
398
|
+
])
|
|
399
|
+
]);
|
|
400
|
+
}
|
|
401
|
+
const { input, ...formatted } = formatTransaction(tx);
|
|
402
|
+
if (formatted.type === "legacy" && (formatted.v === 27n || formatted.v === 28n)) {
|
|
403
|
+
formatted.chainId = void 0;
|
|
404
|
+
}
|
|
405
|
+
const signature = formatted.type === "legacy" ? { r: formatted.r, s: formatted.s, v: formatted.v } : { r: formatted.r, s: formatted.s, yParity: formatted.yParity };
|
|
406
|
+
return serializeTransaction(
|
|
407
|
+
{ ...formatted, data: input },
|
|
408
|
+
//
|
|
409
|
+
signature
|
|
410
|
+
);
|
|
411
|
+
}
|
|
301
412
|
const SUPPORTED_TRANSACTION_TYPES = /* @__PURE__ */ new Set([0n, 1n, 2n, 3n, 4n]);
|
|
302
413
|
function verifyTransactionsRoot(block) {
|
|
303
414
|
const unsupportedTxs = block.eth_getBlockByNumber.transactions.filter((tx) => {
|
|
@@ -310,16 +421,7 @@ function defineIndexer(opts) {
|
|
|
310
421
|
return log.warn("Unable to verify block `transactionsRoot` because of unsupported tx type");
|
|
311
422
|
}
|
|
312
423
|
const transactions = block.eth_getBlockByNumber.transactions.map((tx) => {
|
|
313
|
-
const
|
|
314
|
-
if (formatted.type === "legacy" && (formatted.v === 27n || formatted.v === 28n)) {
|
|
315
|
-
formatted.chainId = void 0;
|
|
316
|
-
}
|
|
317
|
-
const signature = formatted.type === "legacy" ? { r: formatted.r, s: formatted.s, v: formatted.v } : { r: formatted.r, s: formatted.s, yParity: formatted.yParity };
|
|
318
|
-
const serialized = serializeTransaction(
|
|
319
|
-
{ ...formatted, data: input },
|
|
320
|
-
//
|
|
321
|
-
signature
|
|
322
|
-
);
|
|
424
|
+
const serialized = serializeTransaction$1(tx);
|
|
323
425
|
if (!isHexEqual(tx.hash, keccak256(serialized))) {
|
|
324
426
|
throw new Error(`Transaction ${tx.hash} failed serialization check`);
|
|
325
427
|
}
|
|
@@ -930,6 +1032,7 @@ function defineIndexer(opts) {
|
|
|
930
1032
|
event: filter.event,
|
|
931
1033
|
address: filter.address,
|
|
932
1034
|
to_block: filter.toBlock,
|
|
1035
|
+
function: filter.function,
|
|
933
1036
|
from_block: filter.fromBlock
|
|
934
1037
|
};
|
|
935
1038
|
});
|
package/dist/proxy.d.mts
CHANGED
package/dist/proxy.d.ts
CHANGED
package/dist/proxy.mjs
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createLogger, d as decompress, e as decoder } from './shared/univo.DD1x3F1G.mjs';
|
|
1
|
+
import { c as createLogger } from './shared/univo.DEUuEEoe.mjs';
|
|
3
2
|
|
|
4
3
|
function http(opts) {
|
|
5
4
|
const log = createLogger({ quiet: opts.quiet, prefix: "[proxy]" });
|
|
6
5
|
return async function proxy(req) {
|
|
7
|
-
|
|
6
|
+
const authorization = req.headers.get("Authorization");
|
|
7
|
+
const compressed = req.headers.get("Content-Encoding") === "gzip";
|
|
8
|
+
const authenticated = authorization === `Bearer ${opts.signingKey}`;
|
|
9
|
+
if (compressed && (!authorization || !authenticated)) {
|
|
10
|
+
return Response.json(
|
|
11
|
+
{ jsonrpc: "2.0", id: null, error: { code: 0, message: "Invalid bearer token" } },
|
|
12
|
+
//
|
|
13
|
+
{ status: 400 }
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
let body_string = "";
|
|
8
17
|
try {
|
|
9
|
-
|
|
18
|
+
if (compressed) {
|
|
19
|
+
if (!req.body) {
|
|
20
|
+
throw new Error("Missing compressed request body");
|
|
21
|
+
}
|
|
22
|
+
const reader = req.body.pipeThrough(new DecompressionStream("gzip")).pipeThrough(new TextDecoderStream()).getReader();
|
|
23
|
+
try {
|
|
24
|
+
while (true) {
|
|
25
|
+
const { done, value } = await reader.read();
|
|
26
|
+
if (done) {
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
body_string += value;
|
|
30
|
+
}
|
|
31
|
+
} finally {
|
|
32
|
+
reader.releaseLock();
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
body_string = await req.text();
|
|
36
|
+
}
|
|
10
37
|
} catch {
|
|
11
38
|
return Response.json(
|
|
12
39
|
{ jsonrpc: "2.0", id: null, error: { code: 0, message: "Invalid request body" } },
|
|
@@ -14,28 +41,6 @@ function http(opts) {
|
|
|
14
41
|
{ status: 400 }
|
|
15
42
|
);
|
|
16
43
|
}
|
|
17
|
-
const authorization = req.headers.get("Authorization");
|
|
18
|
-
const authenticated = authorization === `Bearer ${opts.signingKey}`;
|
|
19
|
-
let body_string;
|
|
20
|
-
if (req.headers.get("Content-Encoding") === "gzip") {
|
|
21
|
-
if (!authorization) {
|
|
22
|
-
return Response.json(
|
|
23
|
-
{ jsonrpc: "2.0", id: null, error: { code: 0, message: "No bearer token provided" } },
|
|
24
|
-
//
|
|
25
|
-
{ status: 400 }
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
if (!authenticated) {
|
|
29
|
-
return Response.json(
|
|
30
|
-
{ jsonrpc: "2.0", id: null, error: { code: 0, message: "Invalid bearer token" } },
|
|
31
|
-
//
|
|
32
|
-
{ status: 400 }
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
body_string = await decompress(body_buffer);
|
|
36
|
-
} else {
|
|
37
|
-
body_string = decoder.decode(body_buffer);
|
|
38
|
-
}
|
|
39
44
|
let json;
|
|
40
45
|
try {
|
|
41
46
|
json = JSON.parse(body_string);
|
|
@@ -46,40 +51,21 @@ function http(opts) {
|
|
|
46
51
|
{ status: 400 }
|
|
47
52
|
);
|
|
48
53
|
}
|
|
49
|
-
if (json.method.startsWith("private_")) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
if (authorization !== `Bearer ${opts.signingKey}`) {
|
|
58
|
-
return Response.json(
|
|
59
|
-
{ jsonrpc: "2.0", id: json.id, error: { code: 0, message: "Invalid bearer token" } },
|
|
60
|
-
//
|
|
61
|
-
{ status: 400 }
|
|
62
|
-
);
|
|
63
|
-
}
|
|
54
|
+
if (json.method.startsWith("private_") && (!authorization || !authenticated)) {
|
|
55
|
+
return Response.json(
|
|
56
|
+
{ jsonrpc: "2.0", id: json.id, error: { code: 0, message: "Invalid bearer token" } },
|
|
57
|
+
//
|
|
58
|
+
{ status: 400 }
|
|
59
|
+
);
|
|
64
60
|
}
|
|
65
61
|
try {
|
|
66
62
|
const result = await opts.indexer.request({ method: json.method, params: json.params });
|
|
67
63
|
return Response.json({ jsonrpc: "2.0", id: json.id, result });
|
|
68
64
|
} catch (error) {
|
|
69
|
-
const message =
|
|
70
|
-
|
|
71
|
-
log.error(message);
|
|
72
|
-
return Response.json(
|
|
73
|
-
{ jsonrpc: "2.0", id: json.id, error: { code: 0, message } },
|
|
74
|
-
//
|
|
75
|
-
{ status: 400 }
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
if (error instanceof Error) {
|
|
79
|
-
log.error(error.message);
|
|
80
|
-
}
|
|
65
|
+
const message = error instanceof Error ? error.message : "Internal error";
|
|
66
|
+
log.error(message);
|
|
81
67
|
return Response.json(
|
|
82
|
-
{ jsonrpc: "2.0", id: json.id, error: { code: 0, message
|
|
68
|
+
{ jsonrpc: "2.0", id: json.id, error: { code: 0, message } },
|
|
83
69
|
//
|
|
84
70
|
{ status: 500 }
|
|
85
71
|
);
|
package/dist/realtime.d.mts
CHANGED
package/dist/realtime.d.ts
CHANGED
package/dist/realtime.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hexToNumber } from 'viem';
|
|
2
|
-
import { c as createLogger,
|
|
2
|
+
import { c as createLogger, i as iife, m as mutex, l as lifecycle, q as queue, r as retry, a as isHexEqual } from './shared/univo.DEUuEEoe.mjs';
|
|
3
3
|
|
|
4
4
|
function defineBlockchain(opts) {
|
|
5
5
|
const log = createLogger({ quiet: opts.quiet });
|
|
@@ -182,6 +182,7 @@ function realtime(realtime2) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
const mutex_finalize = mutex(finalize);
|
|
185
|
+
void mutex_finalize();
|
|
185
186
|
let chainFinalizedHeight = hexToNumber(chainFinalizedBlock.number);
|
|
186
187
|
async function poll() {
|
|
187
188
|
try {
|
package/dist/rpc.d.mts
CHANGED
package/dist/rpc.d.ts
CHANGED
|
@@ -119,21 +119,7 @@ type Flatten<T> = {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* Extend this interface in your application to expose additional RPC methods to every event:
|
|
125
|
-
*
|
|
126
|
-
* ```ts
|
|
127
|
-
* import "univo";
|
|
128
|
-
*
|
|
129
|
-
* declare module "univo" {
|
|
130
|
-
* interface Block {
|
|
131
|
-
* eth_getBalance: `0x${string}`;
|
|
132
|
-
* }
|
|
133
|
-
* }
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* Your `getBlock` function must also return any required fields added by the augmentation.
|
|
122
|
+
* Block
|
|
137
123
|
*/
|
|
138
124
|
interface Block {
|
|
139
125
|
eth_chainId: `0x${string}`;
|
|
@@ -154,6 +140,8 @@ type Filter = {
|
|
|
154
140
|
event?: `0x${string}`;
|
|
155
141
|
/** Index blocks that involve this address */
|
|
156
142
|
address?: `0x${string}`;
|
|
143
|
+
/** Index blocks where this function signature was invoked */
|
|
144
|
+
function?: `0x${string}`;
|
|
157
145
|
};
|
|
158
146
|
/**
|
|
159
147
|
* Events -----------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -119,21 +119,7 @@ type Flatten<T> = {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* Extend this interface in your application to expose additional RPC methods to every event:
|
|
125
|
-
*
|
|
126
|
-
* ```ts
|
|
127
|
-
* import "univo";
|
|
128
|
-
*
|
|
129
|
-
* declare module "univo" {
|
|
130
|
-
* interface Block {
|
|
131
|
-
* eth_getBalance: `0x${string}`;
|
|
132
|
-
* }
|
|
133
|
-
* }
|
|
134
|
-
* ```
|
|
135
|
-
*
|
|
136
|
-
* Your `getBlock` function must also return any required fields added by the augmentation.
|
|
122
|
+
* Block
|
|
137
123
|
*/
|
|
138
124
|
interface Block {
|
|
139
125
|
eth_chainId: `0x${string}`;
|
|
@@ -154,6 +140,8 @@ type Filter = {
|
|
|
154
140
|
event?: `0x${string}`;
|
|
155
141
|
/** Index blocks that involve this address */
|
|
156
142
|
address?: `0x${string}`;
|
|
143
|
+
/** Index blocks where this function signature was invoked */
|
|
144
|
+
function?: `0x${string}`;
|
|
157
145
|
};
|
|
158
146
|
/**
|
|
159
147
|
* Events -----------------------------------------------------------------------------------------------------------------------------------
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const name = "univo";
|
|
2
|
-
const version = "0.4.
|
|
2
|
+
const version = "0.4.3";
|
|
3
3
|
|
|
4
4
|
function createLogger(opts) {
|
|
5
5
|
const noop = (..._) => {
|
|
@@ -159,4 +159,4 @@ const normalizeHex = (hex, length) => {
|
|
|
159
159
|
return `0x${hex.slice(2).toLowerCase().padStart(length, "0")}`;
|
|
160
160
|
};
|
|
161
161
|
|
|
162
|
-
export {
|
|
162
|
+
export { isHexEqual as a, compress as b, createLogger as c, normalizeHex as d, decompress as e, decoder as f, iife as i, lifecycle as l, mutex as m, name as n, queue as q, retry as r, version as v };
|
package/dist/transport.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as Transport, b as browser, h as http, l as local, w as wss } from './shared/univo.
|
|
1
|
+
export { T as Transport, b as browser, h as http, l as local, w as wss } from './shared/univo.Ckj3I8tQ.mjs';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './metadata.mjs';
|
|
4
4
|
import './metadata/adapters.mjs';
|
package/dist/transport.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { T as Transport, b as browser, h as http, l as local, w as wss } from './shared/univo.
|
|
1
|
+
export { T as Transport, b as browser, h as http, l as local, w as wss } from './shared/univo.7S1OTdpc.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import './metadata.js';
|
|
4
4
|
import './metadata/adapters.js';
|
package/dist/transport.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ws from 'ws';
|
|
2
2
|
import { WebSocket } from 'partysocket';
|
|
3
|
-
import {
|
|
3
|
+
import { b as compress, c as createLogger, m as mutex } from './shared/univo.DEUuEEoe.mjs';
|
|
4
4
|
|
|
5
5
|
const DEFAULT_TIMEOUT_MS = 60 * 1e3;
|
|
6
6
|
function local(rpc) {
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function createException(message) {
|
|
2
|
-
return `univo:${message}`;
|
|
3
|
-
}
|
|
4
|
-
function catchException(unknown, exception) {
|
|
5
|
-
if (unknown instanceof Error) {
|
|
6
|
-
if (unknown.message === exception) {
|
|
7
|
-
return true;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
function getException(unknown) {
|
|
13
|
-
if (unknown instanceof Error) {
|
|
14
|
-
if (unknown.message.startsWith("univo")) {
|
|
15
|
-
const [_, message] = unknown.message.split(":");
|
|
16
|
-
if (message) return message;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { catchException as a, createException as c, getException as g };
|