Skip to content

Commit

Permalink
fix near indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed Nov 20, 2024
1 parent 532323b commit 1b3654a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions packages/near-indexer/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -270,9 +272,9 @@ function parseChainConfig(chainConfigJson: TypedMap<string, JSONValue>, receipt:
return chainConfig;
}

function parseSetPublishChainConfig(chainConfigJson: TypedMap<string, JSONValue>, receipt: near.ActionReceipt): SetPublishChainConfigEvent {
log.debug("!!!### parseChainConfig", []);
const setPublishChainConfigEvent = new SetPublishChainConfigEvent(chainConfigJson.mustGet("version").toString());
function parseSetPublishChainConfig(chainConfigJson: TypedMap<string, JSONValue>, 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());
Expand Down
2 changes: 1 addition & 1 deletion packages/near-indexer/subgraph.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dataSources:
name: receipts
network: near-testnet
source:
# account: 'ormpaggregator.guantong.testnet'
# account: 'aggregator.guantong.testnet'
accounts:
suffixes:
- 'guantong.testnet'
Expand Down

0 comments on commit 1b3654a

Please sign in to comment.