rawToWad
Convert 6-decimal USDC raw units to 18-decimal WAD.
Multiplies by 10^12. The inverse is wadToRaw. Use parseUsdc when the input is a decimal string, not atoms.
Import
import { rawToWad } from "@repo/contract-client/math";
Usage
import { parseUsdc } from "@repo/contract-client";
import { rawToWad } from "@repo/contract-client/math";
const wad = rawToWad(parseUsdc("1"));
// 1_000_000_000_000_000_000n
Return Value
bigint (WAD).
Parameters
raw
- Type:
bigint
Non-negative 6-decimal amount.
rawToWad(1_000_000n);
Error
InvalidAmountError if raw < 0.