Skip to content

[TypeScript client] Tx body's fee field type is different between compile-time and run-time #274

@longngn

Description

@longngn

What Git revision are you using?

v5.5.5

What operating system are you using, and which version?

  • Linux / Ubuntu
  • Linux / Other
  • OSX
  • Windows

Describe what the problem is?

The fee field is bigint in type definition but is number in runtime

How to reproduce:

import {
  createInteractionContext,
  createChainSyncClient,
  InteractionContext,
  isBabbageBlock,
} from "@cardano-ogmios/client";
import { Block, PointOrOrigin, TipOrOrigin } from "@cardano-ogmios/schema";

async function main() {
  const context: InteractionContext = await createInteractionContext(
    (err) => console.error(err),
    () => console.log("Connection closed."),
    { connection: { host: "localhost", port: 1337 } }
  );

  const rollForward = async ({ block }: { block: Block }) => {
    if (!isBabbageBlock(block)) {
      return;
    }
    console.log(typeof block.babbage.body[0].body.fee);
  };

  const rollBackward = async (
    { point, tip }: { point: PointOrOrigin; tip: TipOrOrigin },
    requestNext: () => void
  ): Promise<void> => {
    console.log(`Rollback`);
    requestNext();
  };

  const client = await createChainSyncClient(context, {
    rollForward,
    rollBackward,
  });

  await client.startSync([
    {
      hash: "a79840042fe89e50c4ac4f367dae06d161a6ed6b561d354cd4b036de87a84142",
      slot: 74588465,
    },
  ]);
}

main();

What should be the expected behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclient/TypeScriptIssues which regard the TypeScript client

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions