@token.amount
Convert a human-readable token amount to its base unit (applying decimals).
Returns: number
Syntax
Section titled “Syntax”@token.amount(tokenSymbolOrAddress amount)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
tokenSymbolOrAddress |
token-symbol |
Token symbol (e.g. DAI) or address |
amount |
number |
Human-readable amount |
Examples
Section titled “Examples”# Convert 100 DAI to base unitsset $amount @token.amount(DAI 100)See Also
Section titled “See Also”- @token — resolve token address
- @token.balance — query token balance
- @token.format — format base units as a human-readable string
- @num.parse — generic decimal parsing