Skip to main content
Charli3 is the class most apps will use. Construct it with a network name and call methods on it. No config file, no init step.

Constructor

Methods

getOdvReference

The main read. Returns the current on-chain price for one pair, decoded and ready to use.
If the price is stale, call submitRound2 to post a fresh one.

submitRound2

Build, sign, and submit a Round 2 tx for one pair. This is how you refresh a stale price.
Result fields: What the wallet pays for: the tx fee (about 1.5 tADA) plus the min-UTXO on the outputs. The SDK does not take a cut.

getAllPrices

Reads every feed listed in the preset in parallel. Handy for a dashboard row of other pairs.
Feeds that fail to read (no UTXO found, bad datum) are still returned with rawValue: 0n and isExpired: true. That way you can render them without wrapping every entry in try/catch.

collectFeeds

The Round 1 part of the refresh path, on its own. Fetches every oracle node’s latest signed message, checks the signature, and returns the set. Most apps do not need this. It is here if you want to build something custom on top.

listFeeds / listOdvFeeds

Return the list of pairs available in the current preset. Use them to render a picker or dropdown.

Types

OracleReference

PriceData

OutRef

Build a Cardanoscan link with:

Lower-level exports

charli3-js also exports the internals for anyone who needs to customise the Round 2 build:
  • OracleReader - raw datum reader
  • OracleNodeClient - HTTP client for oracle nodes
  • buildOdvTx, selectOracleUtxos, buildVkeyWitnessSetHex - Round 2 tx construction
  • buildAggregateMessage, medianBigInt - aggregate message builder + consensus helpers
  • consensusNodes, calculateRewardDistribution, calculateMinFeeAmount, IQR_APPLICABILITY_THRESHOLD - IQR internals
  • parseOracleSettings, parseAggState, buildAggStateDatumCbor - datum parsers and builders
  • verifyEd25519, verifyFeedSignature - signature verification helpers
  • PRESETS, PREPROD, MAINNET, getPreset - network presets
See src/index.ts in the repo for the full export list.

Errors you might see

Either the feed has never been posted (rare) or Kupo is slow. Retry in a few seconds, or pass your own kupoUrl.
Some oracle nodes were offline, so the SDK could not collect enough feeds. Usually temporary, the nodes recover in a few minutes.
The validator rejected the tx. Usual causes: stale validity window, a missing signature, or a wallet too low on tADA. The error message names which check failed.