Function parseAssetAmount

    • Parses a human-readable string to a AssetAmount

      Parameters

      • value: string

        The string to parse (e.g., '1.5')

      • decimals: number = 6

        The number of decimal places (default: 6 for KLV)

      Returns AssetAmount

      A AssetAmount in smallest units

      parseAssetAmount('1') // 1000000n (1 KLV)
      parseAssetAmount('1.5') // 1500000n (1.5 KLV)
      parseAssetAmount('0.000001') // 1n (0.000001 KLV)