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

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

Closed
1 of 4 tasks
longngn opened this issue Oct 21, 2022 · 1 comment
Closed
1 of 4 tasks
Labels
bug Something isn't working client/TypeScript Issues which regard the TypeScript client

Comments

@longngn
Copy link

longngn commented Oct 21, 2022

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?

@KtorZ KtorZ added bug Something isn't working client/TypeScript Issues which regard the TypeScript client labels Oct 21, 2022
@KtorZ KtorZ closed this as completed in ad12397 Oct 21, 2022
@KtorZ
Copy link
Member

KtorZ commented Oct 21, 2022

Thanks for reporting! This came from a pretty old commit (ed1d137) where the TypeScript client parser didn't not get updated properly to turn those into bigint.

This is now covered with additional test cases in ad12397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client/TypeScript Issues which regard the TypeScript client
Projects
None yet
Development

No branches or pull requests

2 participants