ponder 0.8.12 → 0.8.13
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/package.json
CHANGED
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
} from "@/sync/source.js";
|
|
22
22
|
import { chains } from "@/utils/chains.js";
|
|
23
23
|
import { toLowerCase } from "@/utils/lowercase.js";
|
|
24
|
-
import
|
|
24
|
+
import { dedupe } from "@ponder/common";
|
|
25
|
+
import type { Hex, LogTopic } from "viem";
|
|
25
26
|
import { buildLogFactory } from "./factory.js";
|
|
26
27
|
|
|
27
28
|
export type RawIndexingFunctions = {
|
|
@@ -488,9 +489,9 @@ export async function buildConfigAndIndexingFunctions({
|
|
|
488
489
|
}
|
|
489
490
|
|
|
490
491
|
const validatedAddress = Array.isArray(resolvedAddress)
|
|
491
|
-
? (resolvedAddress.map((r) => toLowerCase(r))
|
|
492
|
+
? dedupe(resolvedAddress).map((r) => toLowerCase(r))
|
|
492
493
|
: resolvedAddress !== undefined
|
|
493
|
-
?
|
|
494
|
+
? toLowerCase(resolvedAddress)
|
|
494
495
|
: undefined;
|
|
495
496
|
|
|
496
497
|
const logSource = {
|
|
@@ -680,9 +681,9 @@ export async function buildConfigAndIndexingFunctions({
|
|
|
680
681
|
}
|
|
681
682
|
|
|
682
683
|
const validatedAddress = Array.isArray(resolvedAddress)
|
|
683
|
-
? (resolvedAddress.map((r) => toLowerCase(r))
|
|
684
|
+
? dedupe(resolvedAddress).map((r) => toLowerCase(r))
|
|
684
685
|
: resolvedAddress !== undefined
|
|
685
|
-
?
|
|
686
|
+
? toLowerCase(resolvedAddress)
|
|
686
687
|
: undefined;
|
|
687
688
|
|
|
688
689
|
return [
|
package/src/build/factory.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { LogFactory } from "@/sync/source.js";
|
|
2
2
|
import { toLowerCase } from "@/utils/lowercase.js";
|
|
3
3
|
import { getBytesConsumedByParam } from "@/utils/offset.js";
|
|
4
|
+
import { dedupe } from "@ponder/common";
|
|
4
5
|
import type { AbiEvent } from "abitype";
|
|
5
|
-
import { type Address,
|
|
6
|
+
import { type Address, toEventSelector } from "viem";
|
|
6
7
|
|
|
7
8
|
export function buildLogFactory({
|
|
8
9
|
address: _address,
|
|
@@ -16,9 +17,9 @@ export function buildLogFactory({
|
|
|
16
17
|
chainId: number;
|
|
17
18
|
}): LogFactory {
|
|
18
19
|
const address = Array.isArray(_address)
|
|
19
|
-
? _address.map(toLowerCase)
|
|
20
|
+
? dedupe(_address).map(toLowerCase)
|
|
20
21
|
: toLowerCase(_address);
|
|
21
|
-
const eventSelector =
|
|
22
|
+
const eventSelector = toEventSelector(event);
|
|
22
23
|
|
|
23
24
|
// Check if the provided parameter is present in the list of indexed inputs.
|
|
24
25
|
const indexedInputPosition = event.inputs
|
|
@@ -184,6 +184,7 @@ export const createHistoricalSync = async (
|
|
|
184
184
|
return [];
|
|
185
185
|
} else {
|
|
186
186
|
// many addresses
|
|
187
|
+
// Note: it is assumed that `address` is deduplicated
|
|
187
188
|
addressBatches = [];
|
|
188
189
|
for (let i = 0; i < address.length; i += 50) {
|
|
189
190
|
addressBatches.push(address.slice(i, i + 50));
|
package/src/sync-store/index.ts
CHANGED
|
@@ -141,6 +141,7 @@ const logFactorySQL = (
|
|
|
141
141
|
}
|
|
142
142
|
})().as("childAddress"),
|
|
143
143
|
)
|
|
144
|
+
.distinct()
|
|
144
145
|
.$call((qb) => {
|
|
145
146
|
if (Array.isArray(factory.address)) {
|
|
146
147
|
return qb.where("address", "in", factory.address);
|
|
@@ -270,7 +271,6 @@ export const createSyncStore = ({
|
|
|
270
271
|
return await db
|
|
271
272
|
.selectFrom("logs")
|
|
272
273
|
.$call((qb) => logFactorySQL(qb, filter))
|
|
273
|
-
.orderBy("id asc")
|
|
274
274
|
.$if(limit !== undefined, (qb) => qb.limit(limit!))
|
|
275
275
|
.execute()
|
|
276
276
|
.then((addresses) => addresses.map(({ childAddress }) => childAddress));
|