Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added parsing depending on the block type for ChainFollower.ts #872

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ services:
hasura:
build:
context: ./packages/api-cardano-db-hasura/hasura
image: cardanofoundation/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-8.0.1}
image: cardanofoundation/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-8.0.3}
ports:
- ${HASURA_PORT:-8090}:8080
depends_on:
Expand All @@ -100,7 +100,7 @@ services:
cache_from: [ cardanofoundation/cardano-graphql-background:latest ]
context: .
target: background
image: cardanofoundation/cardano-graphql-background:${CARDANO_GRAPHQL_VERSION:-8.0.1}-${NETWORK:-mainnet}
image: cardanofoundation/cardano-graphql-background:${CARDANO_GRAPHQL_VERSION:-8.0.3}-${NETWORK:-mainnet}
depends_on:
- "hasura"
- "postgres"
Expand All @@ -126,7 +126,7 @@ services:
cache_from: [ inputoutput/cardano-graphql-server:latest ]
context: .
target: server
image: cardanofoundation/cardano-graphql-server:${CARDANO_GRAPHQL_VERSION:-8.0.1}-${NETWORK:-mainnet}
image: cardanofoundation/cardano-graphql-server:${CARDANO_GRAPHQL_VERSION:-8.0.3}-${NETWORK:-mainnet}
environment:
- ALLOW_INTROSPECTION=true
- CACHE_ENABLED=true
Expand Down
16 changes: 13 additions & 3 deletions packages/api-cardano-db-hasura/src/ChainFollower.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import util, { assetFingerprint, errors, RunnableModuleState } from '@cardano-gr
import PgBoss from 'pg-boss'
import { dummyLogger, Logger } from 'ts-log'
import { createInteractionContextWithLogger } from './util'
import { PointOrOrigin, BlockPraos } from '@cardano-ogmios/schema'
import { PointOrOrigin, BlockPraos, BlockBFT } from '@cardano-ogmios/schema'
import { HasuraBackgroundClient } from './HasuraBackgroundClient'
import { DbConfig } from './typeAliases'
import { ChainSynchronizationClient } from '@cardano-ogmios/client/dist/ChainSynchronization'
Expand Down Expand Up @@ -60,7 +60,17 @@ export class ChainFollower {
requestNext()
},
rollForward: async ({ block }, requestNext) => {
const b = block as BlockPraos
let b
switch (block.type) {
case 'praos':
b = block as BlockPraos
break
case 'bft':
b = block as BlockBFT
break
case 'ebb': // No transaction in there
return
}
if (b !== undefined && b.transactions !== undefined) {
for (const tx of b.transactions) {
if (tx.mint !== undefined) {
Expand Down Expand Up @@ -90,7 +100,7 @@ export class ChainFollower {
this.logger.info({ module: MODULE_NAME }, 'Initialized')
}

async saveAsset (policyId: string, assetName: string | undefined, b: BlockPraos) {
async saveAsset (policyId: string, assetName: string | undefined, b: BlockPraos | BlockBFT) {
const assetId = `${policyId}${assetName !== undefined ? assetName : ''}`
if (!(await this.hasuraClient.hasAsset(assetId))) {
const asset = {
Expand Down
Loading