From 1b3654a3399573caa56b037c8a9de021b4bf9bbc Mon Sep 17 00:00:00 2001 From: Guantong Date: Wed, 20 Nov 2024 17:11:12 +0800 Subject: [PATCH] fix near indexer --- packages/near-indexer/src/mapping.ts | 12 +++++++----- packages/near-indexer/subgraph.yaml | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/near-indexer/src/mapping.ts b/packages/near-indexer/src/mapping.ts index 6c470d0..876eeb2 100644 --- a/packages/near-indexer/src/mapping.ts +++ b/packages/near-indexer/src/mapping.ts @@ -118,8 +118,10 @@ function handleSetPublishChainConfig(logs: string[], blockHeader: near.BlockHead let setPublishChainConfigEvent = SetPublishChainConfigEvent.load(nanoId); if (setPublishChainConfigEvent == null) { - setPublishChainConfigEvent = parseSetPublishChainConfig(_eventData, receipt); + setPublishChainConfigEvent = parseSetPublishChainConfig(_eventData, nanoId, receipt); setPublishChainConfigEvent.save(); + let publishChainConfig = parseChainConfig(_eventData, receipt); + publishChainConfig.save(); syncAllAggregators(setPublishChainConfigEvent); } else { log.debug("SetPublishChainConfigEvent event already exists: {}", [nanoId]); @@ -157,7 +159,7 @@ function handleSyncPublishChainConfig(logs: string[], blockHeader: near.BlockHea const _version = _eventData.mustGet("version").toString(); let publishChainConfig = PublishChainConfig.load(_version); if (publishChainConfig == null) { - log.error("Can't handleSyncPublishChainConfig, PublishChainConfig does not exist, version: {}", [_version]); + log.error("Can't handleSyncPublishChainConfig, publishChainConfig does not exist, version: {}", [_version]); return; } @@ -270,9 +272,9 @@ function parseChainConfig(chainConfigJson: TypedMap, receipt: return chainConfig; } -function parseSetPublishChainConfig(chainConfigJson: TypedMap, receipt: near.ActionReceipt): SetPublishChainConfigEvent { - log.debug("!!!### parseChainConfig", []); - const setPublishChainConfigEvent = new SetPublishChainConfigEvent(chainConfigJson.mustGet("version").toString()); +function parseSetPublishChainConfig(chainConfigJson: TypedMap, nanoId: string, receipt: near.ActionReceipt): SetPublishChainConfigEvent { + log.debug("!!!### parseSetChainConfig", []); + const setPublishChainConfigEvent = new SetPublishChainConfigEvent(nanoId); setPublishChainConfigEvent.chain_id = BigInt.fromString(chainConfigJson.mustGet("chain_id").toString()); setPublishChainConfigEvent.xapi_address = chainConfigJson.mustGet("xapi_address").toString(); setPublishChainConfigEvent.reporters_fee = BigInt.fromString(chainConfigJson.mustGet("reporters_fee").toString()); diff --git a/packages/near-indexer/subgraph.yaml b/packages/near-indexer/subgraph.yaml index 02be862..1856df3 100644 --- a/packages/near-indexer/subgraph.yaml +++ b/packages/near-indexer/subgraph.yaml @@ -8,7 +8,7 @@ dataSources: name: receipts network: near-testnet source: - # account: 'ormpaggregator.guantong.testnet' + # account: 'aggregator.guantong.testnet' accounts: suffixes: - 'guantong.testnet'