Skip to content

Support for Hedera with 8 decimals #22

Closed
@zeuslawyer

Description

@zeuslawyer

Hedera HBAR is represented as 8 decimals except via the JSON RPC relay. CCIP docs mentions this as well.

How to test/approach

  1. The transferTokens() method from the Client interface in the ccip-js library internally calls getFee() and directly passes its output into the writeContractParameters object, which is then used to invoke the ccipSend() function on the Router contract deployed on Hedera. However, the getFee() method of the contract returns a value with 8 decimals, whereas ccipSend() expects a value with 18 decimals, resulting in a revert and ambiguous error messages .

  2. Additionally, the same getFee() method is called within the Fees.tsx component of the ccip-react-components library. For example, getFee() might return 305761007, which is then formatted using formatEther() from the viem library, followed by .substring(0, 9) for display. Because HBAR uses 8 decimals, the formatEther() function appends trailing zeros, and the substring operation results in a display of only zeros

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions