Skip to content

Commit

Permalink
fix genesisHash fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Nov 25, 2023
1 parent a78393b commit b316fe8
Show file tree
Hide file tree
Showing 31 changed files with 140 additions and 17 deletions.
6 changes: 6 additions & 0 deletions examples/event-processor-bleeps/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# event-processor-bleeps

## 0.0.45

### Patch Changes

- ethereum-indexer-js-processor@0.6.19

## 0.0.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-bleeps/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-bleeps",
"private": true,
"version": "0.0.44",
"version": "0.0.45",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
6 changes: 6 additions & 0 deletions examples/event-processor-conquest-eth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# event-processor-conquest-eth

## 0.0.45

### Patch Changes

- ethereum-indexer-js-processor@0.6.19

## 0.0.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-conquest-eth/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-conquest-eth",
"private": true,
"version": "0.0.44",
"version": "0.0.45",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
6 changes: 6 additions & 0 deletions examples/event-processor-conquest-fplay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# event-processor-conquest-fplay

## 0.0.45

### Patch Changes

- ethereum-indexer-js-processor@0.6.19

## 0.0.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-conquest-fplay/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-conquest-fplay",
"private": true,
"version": "0.0.44",
"version": "0.0.45",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
6 changes: 6 additions & 0 deletions examples/event-processor-nfts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# event-processor-nfts

## 0.0.45

### Patch Changes

- ethereum-indexer-js-processor@0.6.19

## 0.0.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/event-processor-nfts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "event-processor-nfts",
"private": true,
"version": "0.0.44",
"version": "0.0.45",
"description": "",
"type": "module",
"main": "dist/index.cjs",
Expand Down
12 changes: 12 additions & 0 deletions examples/mud/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# web-demo

## 0.1.45

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-browser@0.6.17
- ethereum-indexer-js-processor@0.6.19
- event-processor-bleeps@0.0.45
- event-processor-conquest-eth@0.0.45
- event-processor-nfts@0.0.45

## 0.1.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/mud/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mud-demo",
"private": true,
"version": "0.1.44",
"version": "0.1.45",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
11 changes: 11 additions & 0 deletions examples/web-demo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# web-demo

## 0.1.45

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-browser@0.6.17
- event-processor-bleeps@0.0.45
- event-processor-conquest-eth@0.0.45
- event-processor-nfts@0.0.45

## 0.1.44

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/web-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "web-demo",
"private": true,
"version": "0.1.44",
"version": "0.1.45",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-browser

## 0.6.17

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14

## 0.6.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-browser",
"version": "0.6.16",
"version": "0.6.17",
"publishConfig": {
"access": "public"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/ethereum-indexer-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ethereum-indexer-cli

## 0.6.19

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-utils@0.6.11

## 0.6.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-cli",
"version": "0.6.18",
"version": "0.6.19",
"description": "",
"keywords": [],
"author": "",
Expand Down
8 changes: 8 additions & 0 deletions packages/ethereum-indexer-db-processors/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ethereum-indexer-db-processors

## 0.6.14

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-db-utils@0.6.14

## 0.6.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-db-processors/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-db-processors",
"version": "0.6.13",
"version": "0.6.14",
"description": "",
"publishConfig": {
"access": "public"
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-db-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-db-utils

## 0.6.14

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14

## 0.6.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-db-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-db-utils",
"version": "0.6.13",
"version": "0.6.14",
"description": "",
"publishConfig": {
"access": "public"
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-fs-cache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-fs-event-store

## 0.6.14

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14

## 0.6.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-fs-cache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-fs-cache",
"version": "0.6.13",
"version": "0.6.14",
"description": "",
"publishConfig": {
"access": "public"
Expand Down
7 changes: 7 additions & 0 deletions packages/ethereum-indexer-js-processor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# ethereum-indexer-js-processor

## 0.6.19

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14

## 0.6.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-js-processor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-js-processor",
"version": "0.6.18",
"version": "0.6.19",
"description": "",
"keywords": [],
"author": "",
Expand Down
10 changes: 10 additions & 0 deletions packages/ethereum-indexer-server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# ethereum-indexer-server

## 0.6.22

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-db-utils@0.6.14
- ethereum-indexer-fs-cache@0.6.14
- ethereum-indexer-utils@0.6.11

## 0.6.21

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-server",
"version": "0.6.21",
"version": "0.6.22",
"description": "",
"keywords": [],
"author": "",
Expand Down
8 changes: 8 additions & 0 deletions packages/ethereum-indexer-streams/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ethereum-indexer-server

## 0.6.19

### Patch Changes

- Updated dependencies
- ethereum-indexer@0.6.14
- ethereum-indexer-utils@0.6.11

## 0.6.18

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer-streams/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer-streams",
"version": "0.6.18",
"version": "0.6.19",
"description": "",
"keywords": [],
"author": "",
Expand Down
6 changes: 6 additions & 0 deletions packages/ethereum-indexer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ethereum-indexer

## 0.6.14

### Patch Changes

- fix genesisHash fetch

## 0.6.13

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-indexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereum-indexer",
"version": "0.6.13",
"version": "0.6.14",
"publishConfig": {
"access": "public"
},
Expand Down
12 changes: 10 additions & 2 deletions packages/ethereum-indexer/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
LogTransactionData,
} from './internal/engine/ethereum';

import {EIP1193DATA, EIP1193ProviderWithoutEvents} from 'eip-1193';
import {EIP1193Block, EIP1193DATA, EIP1193ProviderWithoutEvents} from 'eip-1193';

import {logs} from 'named-logs';
import type {
Expand Down Expand Up @@ -297,12 +297,20 @@ export class EthereumIndexer<ABI extends Abi, ProcessResultType = void> {
);
}
if (this.source.genesisHash) {
const genesisHash = await this.provider.request({method: 'eth_getBlockByNumber'});
const genesisBlock = await this.provider.request({method: 'eth_getBlockByNumber', parans: ['earliest', false]}) as EIP1193Block | undefined;
if (!genesisBlock) {
throw new Error(
`Cannot fetch genesis Hash. Expected genesisHash === ${this.source.genesisHash}`
);
} else {
const genesisHash = genesisBlock.hash;
if (genesisHash !== this.source.genesisHash) {
throw new Error(
`Connected to a different chain (genesisHash: ${genesisHash}). Expected genesisHash === ${this.source.genesisHash}`
);
}
}

}

let currentLastSync: LastSync<ABI> | undefined = undefined;
Expand Down

0 comments on commit b316fe8

Please sign in to comment.