Skip to content

[BUG]: Native token symbol in PDF is hardcoded to ETH on non-ETH chains #150

@Atharva0506

Description

@Atharva0506

Bug Description

The PDF generator currently hardcodes ETH for native token representation and network fee labels.
On non-ETH chains (for example Polygon/BSC), exported PDFs still show ETH instead of the correct native symbol (MATIC/BNB).

Why This Is Incorrect

  • In frontend/src/utils/generateInvoicePDF.js:343, token symbol falls back to ETH.
  • In frontend/src/utils/generateInvoicePDF.js:527, network fee is always rendered as ETH.

Note About Reproduction

We used browser console JavaScript for reproduction because Lit services were down.
This issue is in PDF formatting logic and can be reproduced without Lit and without any on-chain transaction cost.

Steps to Reproduce

  1. Run frontend locally.
  2. Open browser DevTools Console.
  3. Execute:
const mod = await import("/src/utils/generateInvoicePDF.js");
const invoice = {
  id: 999,
  isCancelled: false,
  isPaid: false,
  amountDue: "1.25",
  issueDate: new Date().toISOString(),
  dueDate: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(),
  chainId: 137, // Polygon
  paymentToken: null, // Native path
  user: {
    fname: "Alice",
    lname: "Sender",
    address: "0x1111111111111111111111111111111111111111",
    email: "alice@example.com"
  },
  client: {
    fname: "Bob",
    lname: "Receiver",
    address: "0x2222222222222222222222222222222222222222",
    email: "bob@example.com"
  },
  items: [
    {
      description: "Design",
      qty: "1",
      unitPrice: "1.25",
      discount: "0",
      tax: "0",
      amount: "1.25"
    }
  ]
};

const feeWei = "21000000000000";
const pdf = await mod.generateInvoicePDF(invoice, feeWei);
pdf.save("polygon-native-symbol-bug.pdf");

Open the generated PDF and record:

  • Payment currency displays Ether (ETH)
    Network fee displays ETH
  • Chain context is Polygon (chainId: 137)
    Expected Behavior
  • For chainId: 137, native symbol should be MATIC.
  • For chainId: 56, native symbol should be BNB.
  • Network fee label should use the active chain native symbol, not always ETH.
    Actual Behavior
  • PDF displays ETH for native token and network fee regardless of chain context.

Logs and Screenshots

Image

Environment Details

OS: Windows 11
Browser: Chrome

Impact

Medium - Feature works but has issues

Code of Conduct

  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions