diff --git a/indexer/chart/Chart.yaml b/indexer/chart/Chart.yaml index fc9df46..e69a02e 100644 --- a/indexer/chart/Chart.yaml +++ b/indexer/chart/Chart.yaml @@ -2,4 +2,4 @@ name: tfchainindexer description: Helm Chart for the tfchain hydra indexer version: 2.7.6 apiVersion: v2 -appVersion: '2.8.0-rc6' +appVersion: '2.8.0-rc7' diff --git a/package-lock.json b/package-lock.json index ebb7aaa..343136d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "graphql_tfgrid", - "version": "2.8.0-rc6", + "version": "2.8.0-rc7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "graphql_tfgrid", - "version": "2.8.0-rc6", + "version": "2.8.0-rc7", "license": "ISC", "dependencies": { "@subsquid/archive-registry": "1.0.18", diff --git a/package.json b/package.json index 91ab109..d5bf025 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "graphql_tfgrid", "private": "true", - "version": "2.8.0-rc6", + "version": "2.8.0-rc7", "description": "GraphQL server and Substrate indexer. Generated with ♥ by Hydra-CLI", "author": "", "license": "ISC", @@ -41,4 +41,4 @@ "@types/node": "16.11.47", "typescript": "4.7.4" } -} +} \ No newline at end of file diff --git a/processor-chart/Chart.yaml b/processor-chart/Chart.yaml index 420193d..4a6e8ba 100644 --- a/processor-chart/Chart.yaml +++ b/processor-chart/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: tfchain-processor description: A chart for the tfchain graphql processor and query node version: 1.0.5 -appVersion: '2.8.0-rc6' +appVersion: '2.8.0-rc7' diff --git a/src/mappings/contracts.ts b/src/mappings/contracts.ts index 448e710..1eeead7 100644 --- a/src/mappings/contracts.ts +++ b/src/mappings/contracts.ts @@ -1,5 +1,4 @@ import { Store } from '@subsquid/typeorm-store' -import { Equal } from 'typeorm'; import { Ctx } from '../processor' import { EventItem } from '@subsquid/substrate-processor/lib/interfaces/dataSelection' @@ -377,7 +376,7 @@ export async function contractUpdateUsedResources( const savedContract = await ctx.store.get(NodeContract, { where: { contractID: usedResources.contractId } }) if (!savedContract) return - const savedContractResources = await ctx.store.get(ContractResources, { where: { contract: Equal(savedContract) }, relations: { contract: true } }) + const savedContractResources = await ctx.store.get(ContractResources, { where: { contract: { contractID: savedContract.contractID } }, relations: { contract: true } }) if (savedContractResources) { savedContractResources.cru = usedResources.used.cru savedContractResources.sru = usedResources.used.sru diff --git a/src/mappings/nodes.ts b/src/mappings/nodes.ts index 98efae6..6153d5a 100644 --- a/src/mappings/nodes.ts +++ b/src/mappings/nodes.ts @@ -1,6 +1,5 @@ import { Node, Location, PublicConfig, NodeCertification, Interfaces, UptimeEvent, NodeResourcesTotal } from "../model"; import { TfgridModuleNodeCertificationSetEvent, TfgridModuleNodeDeletedEvent, TfgridModuleNodePublicConfigStoredEvent, TfgridModuleNodeStoredEvent, TfgridModuleNodeUpdatedEvent, TfgridModuleNodeUptimeReportedEvent } from "../types/events"; -import { Equal } from 'typeorm'; import { SubstrateBlock } from '@subsquid/substrate-processor'; import { In } from 'typeorm' import { EventItem } from '@subsquid/substrate-processor/lib/interfaces/dataSelection' @@ -126,7 +125,6 @@ export async function nodeStored( resourcesTotal.hru = nodeEvent.resources.hru resourcesTotal.mru = nodeEvent.resources.mru resourcesTotal.cru = nodeEvent.resources.cru - await ctx.store.save(resourcesTotal) newNode.interfaces = [] @@ -184,7 +182,7 @@ export async function nodeUpdated( savedNode.farmingPolicyId = nodeEvent.farmingPolicyId // Recalculate total / free resoures when a node get's updated - let resourcesTotal = await ctx.store.get(NodeResourcesTotal, { where: { node: Equal(savedNode) }, relations: { node: true } }) + let resourcesTotal = await ctx.store.get(NodeResourcesTotal, { where: { node: { nodeID: savedNode.nodeID } }, relations: { node: true } }) if (resourcesTotal) { resourcesTotal.sru = nodeEvent.resources.sru resourcesTotal.hru = nodeEvent.resources.hru @@ -353,21 +351,21 @@ export async function nodeDeleted( ) { const nodeID = new TfgridModuleNodeDeletedEvent(ctx, item.event).asV49 - const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true } }) + const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true, interfaces: true } }) if (savedNode) { - const resourcesTotal = await ctx.store.find(NodeResourcesTotal, { where: { node: Equal(savedNode) }, relations: { node: true } }) + const resourcesTotal = await ctx.store.find(NodeResourcesTotal, { where: { node: { nodeID: savedNode.nodeID } }, relations: { node: true } }) if (resourcesTotal) { const p = resourcesTotal.map(r => ctx.store.remove(r)) await Promise.all(p) } - const pubConfig = await ctx.store.get(PublicConfig, { where: { node: Equal(savedNode) }, relations: { node: true } }) + const pubConfig = await ctx.store.get(PublicConfig, { where: { node: { nodeID: savedNode.nodeID } }, relations: { node: true } }) if (pubConfig) { await ctx.store.remove(pubConfig) } - const intfs = await ctx.store.find(Interfaces, { where: { node: Equal(savedNode) }, relations: { node: true } }) + const intfs = await ctx.store.find(Interfaces, { where: { node: { nodeID: savedNode.nodeID } }, relations: { node: true } }) const promises = intfs.map(intf => { return ctx.store.remove(intf) }) @@ -449,10 +447,10 @@ export async function nodePublicConfigStored( return } - const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true } }) + const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true, interfaces: true } }) if (!savedNode) return - let publicConfig = await ctx.store.get(PublicConfig, { where: { node: Equal(savedNode) }, relations: { node: true } }) + let publicConfig = await ctx.store.get(PublicConfig, { where: { node: { nodeID: savedNode.nodeID } }, relations: { node: true } }) if (!publicConfig) { publicConfig = new PublicConfig() @@ -475,7 +473,7 @@ export async function nodeCertificationSet( ) { const [nodeID, certification] = new TfgridModuleNodeCertificationSetEvent(ctx, item.event).asV63 - const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true } }) + const savedNode = await ctx.store.get(Node, { where: { nodeID: nodeID }, relations: { location: true, interfaces: true } }) if (!savedNode) return let certType = NodeCertification.Diy