diff --git a/apps/indexer/package.json b/apps/indexer/package.json index c1aee8deb..5bd53ebbe 100644 --- a/apps/indexer/package.json +++ b/apps/indexer/package.json @@ -29,10 +29,8 @@ "typescript": "^5.3.3" }, "dependencies": { - "@dfuse/client": "^0.3.21", "@sentry/node": "^7.98.0", "lodash": "^4.17.21", - "nexus": "^1.3.0", - "node-fetch": "3.3" + "viem": "latest" } } \ No newline at end of file diff --git a/apps/indexer/src/evm-client.ts b/apps/indexer/src/evm-client.ts index 52be56c0a..1c08a4d21 100644 --- a/apps/indexer/src/evm-client.ts +++ b/apps/indexer/src/evm-client.ts @@ -1,7 +1,7 @@ -import { http, createPublicClient } from 'viem' +import { http, createPublicClient, PublicClient } from 'viem' import { eosEvmTestnet } from 'smartsale-chains' -export const client = createPublicClient({ +export const client: PublicClient = createPublicClient({ chain: eosEvmTestnet, transport: http(), }) diff --git a/apps/indexer/src/indexer.ts b/apps/indexer/src/indexer.ts index 1a62ab3bf..99c479183 100644 --- a/apps/indexer/src/indexer.ts +++ b/apps/indexer/src/indexer.ts @@ -1,8 +1,8 @@ -import { stringify } from 'viem' +import { stringify, parseEventLogs } from 'viem' import { client } from './evm-client' import { TestnetEasyAuction } from 'smartsale-abis' -export async function startIndexer(){ +export async function startIndexer() { console.log('indexing starting') // await writeToFile(stringify(TestnetEasyAuction.getEvents(), null, 2), './events.json') @@ -13,17 +13,20 @@ export async function startIndexer(){ fromBlock: BigInt(TestnetEasyAuction.indexFromBlock), toBlock: blockNumber, }) - // console.log(stringify(logs, null, 2)) - // await writeToFile(stringify(logs.filter((log) => log.eventName !== 'OwnershipTransferred'), null, 2), './logs.json') + const filteredlogs = logs.filter((log) => log.eventName !== 'OwnershipTransferred') + console.log( + stringify(parseEventLogs({ abi: TestnetEasyAuction.abi, logs: filteredlogs }), null, 2), + ) + // await writeToFile(stringify(, null, 2), './logs.json') // Watch for new event logs client.watchEvent({ events: TestnetEasyAuction.getEvents(), onLogs: (logs) => { - console.log(stringify(logs, null, 2)) - } + const filteredlogs = logs.filter((log) => log.eventName !== 'OwnershipTransferred') + console.log( + stringify(parseEventLogs({ abi: TestnetEasyAuction.abi, logs: filteredlogs }), null, 2), + ) + }, }) } - - - diff --git a/bun.lockb b/bun.lockb index f09d15220..60892f696 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index a6f687a65..13bd53cdf 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,9 @@ "**/vite", "**/vite/**", "**/supabase", - "**/supabase/**" + "**/supabase/**", + "**/viem", + "**/viem/**" ] }, "dependencies": { diff --git a/packages/smartsale-chains/package.json b/packages/smartsale-chains/package.json index 51bc224b2..98bc4d014 100644 --- a/packages/smartsale-chains/package.json +++ b/packages/smartsale-chains/package.json @@ -8,7 +8,7 @@ "main": "./src/index.ts", "types": "./src/index.ts", "dependencies": { - "viem": "^1.20.3" + "viem": "latest" }, "devDependencies": { "tsconfig": "workspace:*", diff --git a/packages/smartsale-chains/src/chains.ts b/packages/smartsale-chains/src/chains.ts index c25fdbe61..25fbf8bcb 100644 --- a/packages/smartsale-chains/src/chains.ts +++ b/packages/smartsale-chains/src/chains.ts @@ -1,7 +1,6 @@ import { Chain } from "viem"; -export const eosEvmTestnet : Chain = { - network: 'eos', +export const eosEvmTestnet: Chain = { nativeCurrency: { name: 'EOS', symbol: 'EOS', @@ -20,4 +19,4 @@ export const eosEvmTestnet : Chain = { }; export const smartsaleChainsTestnet = [eosEvmTestnet] -export const smartsaleChainsMainnet = [eosEvmTestnet] \ No newline at end of file +export const smartsaleChainsMainnet = [] \ No newline at end of file