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
| Field | Type | Required | Notes |
|---|---|---|---|
network | "preprod" | "mainnet" | yes | Picks the preset (feeds, nodes, addresses, reference script). |
kupoUrl | string | no | Override the baked-in Kupo endpoint with your own indexer if you prefer. |
Methods
getOdvReference
submitRound2 to post a fresh one.
submitRound2
| Field | Type | Notes |
|---|---|---|
txHash | string? | Submitted tx hash. Undefined if the build produced no tx (error path). |
build.medianValue | bigint | The IQR-consensus median of the feeds used. |
build.validityMs | {start, end} | The validity window written into the new datum. |
build.rewardDistribution | [] | Which nodes’ feeds were aggregated and their reward share. |
getAllPrices
rawValue: 0n and isExpired: true. That way you can render them without wrapping every entry in try/catch.
collectFeeds
listFeeds / listOdvFeeds
Types
OracleReference
PriceData
OutRef
Lower-level exports
charli3-js also exports the internals for anyone who needs to customise the Round 2 build:
OracleReader- raw datum readerOracleNodeClient- HTTP client for oracle nodesbuildOdvTx,selectOracleUtxos,buildVkeyWitnessSetHex- Round 2 tx constructionbuildAggregateMessage,medianBigInt- aggregate message builder + consensus helpersconsensusNodes,calculateRewardDistribution,calculateMinFeeAmount,IQR_APPLICABILITY_THRESHOLD- IQR internalsparseOracleSettings,parseAggState,buildAggStateDatumCbor- datum parsers and buildersverifyEd25519,verifyFeedSignature- signature verification helpersPRESETS,PREPROD,MAINNET,getPreset- network presets
src/index.ts in the repo for the full export list.
Errors you might see
No UTXO found at ODV address
No UTXO found at ODV address
Either the feed has never been posted (rare) or Kupo is slow. Retry in a few seconds, or pass your own
kupoUrl.Aggregate build failed: not enough feeds
Aggregate build failed: not enough feeds
Some oracle nodes were offline, so the SDK could not collect enough feeds. Usually temporary, the nodes recover in a few minutes.
Submit failed with on-chain error
Submit failed with on-chain error
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.