decode_bundle_decimal

Documentation for eth_defi.chainlink.bundle_aggregator.decode_bundle_decimal function.

decode_bundle_decimal(bundle, index, decimals, *, signed=False)

Decode one fixed-width numeric field from a Chainlink bundle.

Bundle schemas may mix numeric and dynamic fields. The caller is responsible for selecting a numeric word and supplying the corresponding scale from bundleDecimals().

Parameters
  • bundle (bytes) – Raw bundle returned by latestBundle() or its update event.

  • index (int) – Zero-based 32-byte word index.

  • decimals (int) – Decimal scale for this field.

  • signed (bool) – Decode the word as a signed two’s-complement integer.

Returns

Human-readable decimal value.

Raises

ValueError – If the index, decimal scale, or payload length is invalid.

Return type

decimal.Decimal