diff --git a/examples/event-processor-bleeps/CHANGELOG.md b/examples/event-processor-bleeps/CHANGELOG.md index 24bedf4..4c2dff0 100644 --- a/examples/event-processor-bleeps/CHANGELOG.md +++ b/examples/event-processor-bleeps/CHANGELOG.md @@ -1,5 +1,11 @@ # event-processor-bleeps +## 0.0.44 + +### Patch Changes + +- ethereum-indexer-js-processor@0.6.18 + ## 0.0.43 ### Patch Changes diff --git a/examples/event-processor-bleeps/package.json b/examples/event-processor-bleeps/package.json index 15addd5..3c81f9b 100644 --- a/examples/event-processor-bleeps/package.json +++ b/examples/event-processor-bleeps/package.json @@ -1,7 +1,7 @@ { "name": "event-processor-bleeps", "private": true, - "version": "0.0.43", + "version": "0.0.44", "description": "", "type": "module", "main": "dist/index.cjs", diff --git a/examples/event-processor-conquest-eth/CHANGELOG.md b/examples/event-processor-conquest-eth/CHANGELOG.md index bd20c98..6add043 100644 --- a/examples/event-processor-conquest-eth/CHANGELOG.md +++ b/examples/event-processor-conquest-eth/CHANGELOG.md @@ -1,5 +1,11 @@ # event-processor-conquest-eth +## 0.0.44 + +### Patch Changes + +- ethereum-indexer-js-processor@0.6.18 + ## 0.0.43 ### Patch Changes diff --git a/examples/event-processor-conquest-eth/package.json b/examples/event-processor-conquest-eth/package.json index 7e6b679..0084b5b 100644 --- a/examples/event-processor-conquest-eth/package.json +++ b/examples/event-processor-conquest-eth/package.json @@ -1,7 +1,7 @@ { "name": "event-processor-conquest-eth", "private": true, - "version": "0.0.43", + "version": "0.0.44", "description": "", "type": "module", "main": "dist/index.cjs", diff --git a/examples/event-processor-conquest-fplay/CHANGELOG.md b/examples/event-processor-conquest-fplay/CHANGELOG.md index f1ecb9e..dca5599 100644 --- a/examples/event-processor-conquest-fplay/CHANGELOG.md +++ b/examples/event-processor-conquest-fplay/CHANGELOG.md @@ -1,5 +1,11 @@ # event-processor-conquest-fplay +## 0.0.44 + +### Patch Changes + +- ethereum-indexer-js-processor@0.6.18 + ## 0.0.43 ### Patch Changes diff --git a/examples/event-processor-conquest-fplay/package.json b/examples/event-processor-conquest-fplay/package.json index 1e857aa..29f2f06 100644 --- a/examples/event-processor-conquest-fplay/package.json +++ b/examples/event-processor-conquest-fplay/package.json @@ -1,7 +1,7 @@ { "name": "event-processor-conquest-fplay", "private": true, - "version": "0.0.43", + "version": "0.0.44", "description": "", "type": "module", "main": "dist/index.cjs", diff --git a/examples/event-processor-nfts/CHANGELOG.md b/examples/event-processor-nfts/CHANGELOG.md index 35927e5..f67e20a 100644 --- a/examples/event-processor-nfts/CHANGELOG.md +++ b/examples/event-processor-nfts/CHANGELOG.md @@ -1,5 +1,11 @@ # event-processor-nfts +## 0.0.44 + +### Patch Changes + +- ethereum-indexer-js-processor@0.6.18 + ## 0.0.43 ### Patch Changes diff --git a/examples/event-processor-nfts/package.json b/examples/event-processor-nfts/package.json index f85331e..8420b8c 100644 --- a/examples/event-processor-nfts/package.json +++ b/examples/event-processor-nfts/package.json @@ -1,7 +1,7 @@ { "name": "event-processor-nfts", "private": true, - "version": "0.0.43", + "version": "0.0.44", "description": "", "type": "module", "main": "dist/index.cjs", diff --git a/examples/mud/CHANGELOG.md b/examples/mud/CHANGELOG.md index bda0a70..8c50bef 100644 --- a/examples/mud/CHANGELOG.md +++ b/examples/mud/CHANGELOG.md @@ -1,5 +1,17 @@ # web-demo +## 0.1.43 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + - ethereum-indexer-browser@0.6.15 + - ethereum-indexer-js-processor@0.6.18 + - event-processor-bleeps@0.0.44 + - event-processor-conquest-eth@0.0.44 + - event-processor-nfts@0.0.44 + ## 0.1.42 ### Patch Changes diff --git a/examples/mud/package.json b/examples/mud/package.json index dc162d1..2817921 100644 --- a/examples/mud/package.json +++ b/examples/mud/package.json @@ -1,7 +1,7 @@ { "name": "mud-demo", "private": true, - "version": "0.1.42", + "version": "0.1.43", "type": "module", "scripts": { "dev": "vite", diff --git a/examples/web-demo/CHANGELOG.md b/examples/web-demo/CHANGELOG.md index b7e5921..6f7d0a0 100644 --- a/examples/web-demo/CHANGELOG.md +++ b/examples/web-demo/CHANGELOG.md @@ -1,5 +1,16 @@ # web-demo +## 0.1.43 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + - ethereum-indexer-browser@0.6.15 + - event-processor-bleeps@0.0.44 + - event-processor-conquest-eth@0.0.44 + - event-processor-nfts@0.0.44 + ## 0.1.42 ### Patch Changes diff --git a/examples/web-demo/package.json b/examples/web-demo/package.json index c71c25f..195b8d1 100644 --- a/examples/web-demo/package.json +++ b/examples/web-demo/package.json @@ -1,7 +1,7 @@ { "name": "web-demo", "private": true, - "version": "0.1.42", + "version": "0.1.43", "type": "module", "scripts": { "dev": "vite", diff --git a/packages/ethereum-indexer-browser/CHANGELOG.md b/packages/ethereum-indexer-browser/CHANGELOG.md index 4a21caa..77bf69c 100644 --- a/packages/ethereum-indexer-browser/CHANGELOG.md +++ b/packages/ethereum-indexer-browser/CHANGELOG.md @@ -1,5 +1,12 @@ # ethereum-indexer-browser +## 0.6.15 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + ## 0.6.14 ### Patch Changes diff --git a/packages/ethereum-indexer-browser/package.json b/packages/ethereum-indexer-browser/package.json index bce4549..93349af 100644 --- a/packages/ethereum-indexer-browser/package.json +++ b/packages/ethereum-indexer-browser/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-browser", - "version": "0.6.14", + "version": "0.6.15", "publishConfig": { "access": "public" }, diff --git a/packages/ethereum-indexer-cli/CHANGELOG.md b/packages/ethereum-indexer-cli/CHANGELOG.md index 478dbc7..43c6c11 100644 --- a/packages/ethereum-indexer-cli/CHANGELOG.md +++ b/packages/ethereum-indexer-cli/CHANGELOG.md @@ -1,5 +1,13 @@ # ethereum-indexer-cli +## 0.6.18 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer-utils@0.6.11 + - ethereum-indexer@0.6.13 + ## 0.6.17 ### Patch Changes diff --git a/packages/ethereum-indexer-cli/package.json b/packages/ethereum-indexer-cli/package.json index 342f708..171d071 100644 --- a/packages/ethereum-indexer-cli/package.json +++ b/packages/ethereum-indexer-cli/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-cli", - "version": "0.6.17", + "version": "0.6.18", "description": "", "keywords": [], "author": "", diff --git a/packages/ethereum-indexer-db-processors/CHANGELOG.md b/packages/ethereum-indexer-db-processors/CHANGELOG.md index 5c1bd2b..fe00db4 100644 --- a/packages/ethereum-indexer-db-processors/CHANGELOG.md +++ b/packages/ethereum-indexer-db-processors/CHANGELOG.md @@ -1,5 +1,13 @@ # ethereum-indexer-db-processors +## 0.6.13 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + - ethereum-indexer-db-utils@0.6.13 + ## 0.6.12 ### Patch Changes diff --git a/packages/ethereum-indexer-db-processors/package.json b/packages/ethereum-indexer-db-processors/package.json index facb0d3..082edf8 100644 --- a/packages/ethereum-indexer-db-processors/package.json +++ b/packages/ethereum-indexer-db-processors/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-db-processors", - "version": "0.6.12", + "version": "0.6.13", "description": "", "publishConfig": { "access": "public" diff --git a/packages/ethereum-indexer-db-utils/CHANGELOG.md b/packages/ethereum-indexer-db-utils/CHANGELOG.md index e42211b..66fa4fa 100644 --- a/packages/ethereum-indexer-db-utils/CHANGELOG.md +++ b/packages/ethereum-indexer-db-utils/CHANGELOG.md @@ -1,5 +1,12 @@ # ethereum-indexer-db-utils +## 0.6.13 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + ## 0.6.12 ### Patch Changes diff --git a/packages/ethereum-indexer-db-utils/package.json b/packages/ethereum-indexer-db-utils/package.json index 95981c0..e1ad408 100644 --- a/packages/ethereum-indexer-db-utils/package.json +++ b/packages/ethereum-indexer-db-utils/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-db-utils", - "version": "0.6.12", + "version": "0.6.13", "description": "", "publishConfig": { "access": "public" diff --git a/packages/ethereum-indexer-fs-cache/CHANGELOG.md b/packages/ethereum-indexer-fs-cache/CHANGELOG.md index d2ecd6e..0046b68 100644 --- a/packages/ethereum-indexer-fs-cache/CHANGELOG.md +++ b/packages/ethereum-indexer-fs-cache/CHANGELOG.md @@ -1,5 +1,12 @@ # ethereum-indexer-fs-event-store +## 0.6.13 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + ## 0.6.12 ### Patch Changes diff --git a/packages/ethereum-indexer-fs-cache/package.json b/packages/ethereum-indexer-fs-cache/package.json index ca9f6b4..5429bb8 100644 --- a/packages/ethereum-indexer-fs-cache/package.json +++ b/packages/ethereum-indexer-fs-cache/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-fs-cache", - "version": "0.6.12", + "version": "0.6.13", "description": "", "publishConfig": { "access": "public" diff --git a/packages/ethereum-indexer-js-processor/CHANGELOG.md b/packages/ethereum-indexer-js-processor/CHANGELOG.md index 339114c..5a3fc96 100644 --- a/packages/ethereum-indexer-js-processor/CHANGELOG.md +++ b/packages/ethereum-indexer-js-processor/CHANGELOG.md @@ -1,5 +1,12 @@ # ethereum-indexer-js-processor +## 0.6.18 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer@0.6.13 + ## 0.6.17 ### Patch Changes diff --git a/packages/ethereum-indexer-js-processor/package.json b/packages/ethereum-indexer-js-processor/package.json index 723755c..b141861 100644 --- a/packages/ethereum-indexer-js-processor/package.json +++ b/packages/ethereum-indexer-js-processor/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-js-processor", - "version": "0.6.17", + "version": "0.6.18", "description": "", "keywords": [], "author": "", diff --git a/packages/ethereum-indexer-server/CHANGELOG.md b/packages/ethereum-indexer-server/CHANGELOG.md index 635586a..4c53390 100644 --- a/packages/ethereum-indexer-server/CHANGELOG.md +++ b/packages/ethereum-indexer-server/CHANGELOG.md @@ -1,5 +1,15 @@ # ethereum-indexer-server +## 0.6.21 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer-utils@0.6.11 + - ethereum-indexer@0.6.13 + - ethereum-indexer-db-utils@0.6.13 + - ethereum-indexer-fs-cache@0.6.13 + ## 0.6.20 ### Patch Changes diff --git a/packages/ethereum-indexer-server/package.json b/packages/ethereum-indexer-server/package.json index 801c04d..2c692b4 100644 --- a/packages/ethereum-indexer-server/package.json +++ b/packages/ethereum-indexer-server/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-server", - "version": "0.6.20", + "version": "0.6.21", "description": "", "keywords": [], "author": "", diff --git a/packages/ethereum-indexer-streams/CHANGELOG.md b/packages/ethereum-indexer-streams/CHANGELOG.md index e2048ed..cfb64a6 100644 --- a/packages/ethereum-indexer-streams/CHANGELOG.md +++ b/packages/ethereum-indexer-streams/CHANGELOG.md @@ -1,5 +1,13 @@ # ethereum-indexer-server +## 0.6.18 + +### Patch Changes + +- Updated dependencies + - ethereum-indexer-utils@0.6.11 + - ethereum-indexer@0.6.13 + ## 0.6.17 ### Patch Changes diff --git a/packages/ethereum-indexer-streams/package.json b/packages/ethereum-indexer-streams/package.json index 9f4a576..f27f10a 100644 --- a/packages/ethereum-indexer-streams/package.json +++ b/packages/ethereum-indexer-streams/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-streams", - "version": "0.6.17", + "version": "0.6.18", "description": "", "keywords": [], "author": "", diff --git a/packages/ethereum-indexer-utils/CHANGELOG.md b/packages/ethereum-indexer-utils/CHANGELOG.md index 84ab62a..b932146 100644 --- a/packages/ethereum-indexer-utils/CHANGELOG.md +++ b/packages/ethereum-indexer-utils/CHANGELOG.md @@ -1,5 +1,11 @@ # ethereum-indexer-utils +## 0.6.11 + +### Patch Changes + +- let specify genesisHash as source param, useful for local chain + ## 0.6.10 ### Patch Changes diff --git a/packages/ethereum-indexer-utils/package.json b/packages/ethereum-indexer-utils/package.json index 79dfe93..cf9815d 100644 --- a/packages/ethereum-indexer-utils/package.json +++ b/packages/ethereum-indexer-utils/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer-utils", - "version": "0.6.10", + "version": "0.6.11", "description": "", "publishConfig": { "access": "public" diff --git a/packages/ethereum-indexer-utils/src/contracts.ts b/packages/ethereum-indexer-utils/src/contracts.ts index 6bec5e5..3c1c9b6 100644 --- a/packages/ethereum-indexer-utils/src/contracts.ts +++ b/packages/ethereum-indexer-utils/src/contracts.ts @@ -40,6 +40,7 @@ export function loadContractsFromFile(file: string): IndexingSo contracts: Object.keys(contracts.contracts).map( (name) => (contracts as any).contracts[name], ), + genesisHash: contracts.genesisHash } } @@ -49,12 +50,20 @@ export function loadContractsFromFolder(folder: string): Indexi const contractsAdded: {[address: string]: {index: number}} = {}; const contractsData: ContractData[] = []; const files = fs.readdirSync(folder); - let chainId = undefined; + let genesisHash: `0x${string}` | undefined = undefined; + let chainId: string | undefined = undefined; for (const file of files) { if (file === '.chainId') { chainId = fs.readFileSync(path.join(folder, file), 'utf8'); continue; } + if (file === '.chain') { + const str = fs.readFileSync(path.join(folder, file), 'utf8'); + const {chainId: chainIdFromFile, genesisHash: genesisHashFromFile} = JSON.parse(str); + chainId = chainIdFromFile; + genesisHash = genesisHashFromFile; + continue; + } if (!file.endsWith('.json')) { continue; } @@ -92,5 +101,6 @@ export function loadContractsFromFolder(folder: string): Indexi return { chainId, contracts: contractsData, + genesisHash }; } diff --git a/packages/ethereum-indexer/CHANGELOG.md b/packages/ethereum-indexer/CHANGELOG.md index 66a3d6e..d6abe7f 100644 --- a/packages/ethereum-indexer/CHANGELOG.md +++ b/packages/ethereum-indexer/CHANGELOG.md @@ -1,5 +1,11 @@ # ethereum-indexer +## 0.6.13 + +### Patch Changes + +- let specify genesisHash as source param, useful for local chain + ## 0.6.12 ### Patch Changes diff --git a/packages/ethereum-indexer/package.json b/packages/ethereum-indexer/package.json index 37048e7..4da81a4 100644 --- a/packages/ethereum-indexer/package.json +++ b/packages/ethereum-indexer/package.json @@ -1,6 +1,6 @@ { "name": "ethereum-indexer", - "version": "0.6.12", + "version": "0.6.13", "publishConfig": { "access": "public" }, diff --git a/packages/ethereum-indexer/src/indexer.ts b/packages/ethereum-indexer/src/indexer.ts index e62137e..63ae444 100644 --- a/packages/ethereum-indexer/src/indexer.ts +++ b/packages/ethereum-indexer/src/indexer.ts @@ -296,6 +296,14 @@ export class EthereumIndexer { `Connected to a different chain (chainId : ${chainId}). Expected chainId === ${this.source.chainId}` ); } + if (this.source.genesisHash) { + const genesisHash = await this.provider.request({method: 'eth_getBlockByNumber'}); + if (genesisHash !== this.source.genesisHash) { + throw new Error( + `Connected to a different chain (genesisHash: ${genesisHash}). Expected genesisHash === ${this.source.genesisHash}` + ); + } + } let currentLastSync: LastSync | undefined = undefined; await this._onLoad('Loading'); diff --git a/packages/ethereum-indexer/src/types.ts b/packages/ethereum-indexer/src/types.ts index eb8a630..9e4df39 100644 --- a/packages/ethereum-indexer/src/types.ts +++ b/packages/ethereum-indexer/src/types.ts @@ -80,6 +80,7 @@ export type AllContractData = { export type IndexingSource = { readonly contracts: readonly ContractData[] | AllContractData; readonly chainId: string; + readonly genesisHash?: `0x${string}`; }; export type StreamFecther = (