@num.parse
Parse a decimal string with a given number of decimals (like parseUnits).
Returns: number
Syntax
Section titled “Syntax”@num.parse(value decimals)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
value |
any |
Input value |
decimals |
number |
Number of decimal places |
Examples
Section titled “Examples”# Parse ETH to wei (18 decimals)set $wei @num.parse("1.5" 18)
# Parse USDC (6 decimals)set $raw @num.parse("1.5" 6)See Also
Section titled “See Also”- @num.format — inverse: format an integer with decimals
- @token.amount — token-aware unit conversion