Skip to content

Reference

calculateTrafficCostInDollars

Convenience wrapper dividing calculateTrafficCostInCents by 100 for human-readable USD estimates.

calculateTrafficCostInDollars forwards to calculateTrafficCostInCents and divides by 100, sharing the same pricePerMBCents default.

Setup

import { calculateTrafficCostInDollars } from '@fairmint/canton-node-sdk';

Minimal example

const dollars = calculateTrafficCostInDollars(55 * 1024);
console.log(dollars.toFixed(2));

Parameters

  • bytes — Byte total to price.
  • pricePerMBCents (optional) — Pricing override.

Returns

number — US dollar float (still imprecise for money; prefer cents for accounting).

See also

Source

src/utils/traffic/types.ts