examples/devnet. They exercise the current activation, booking, streaming, fixture validation, and V4 odds and stat validation flows against https://txline-dev.txodds.com.
The scripts use the devnet IDL and generated types in
examples/devnet/idl/txoracle.json and examples/devnet/types/txoracle.ts. For mainnet integrations, use the root idl/txoracle.json and types/txoracle.ts, or the mainnet scripts under examples/mainnet.Requirements
- Node.js
20or newer. The current lockfile resolveseventsource@4.1.0, which declaresnode >=20.0.0. - A devnet wallet keypair file for
ANCHOR_WALLET, funded with devnet SOL for transaction fees. ANCHOR_PROVIDER_URL="https://api.devnet.solana.com".TOKEN_MINT_ADDRESS=4Zao8ocPhmMgq7PdsYWyxvqySMGx7xb9cMftPMkEokRG.
Recommended Order
A fixture must be booked before its data can be validated on-chain, so run the scripts in this order on a fresh wallet:1
Fund the wallet with mock USDT
request_devnet_usdt.ts requests mock USDT from the program’s devnet faucet.2
Buy TxL
purchase_tokens_usdt.ts buys TxL with USDT through a backend-signed quote. Booking is paid in TxL.3
Subscribe and fetch data
subscription_free_tier.ts subscribes, activates an API token, and fetches fixtures and odds. show_pricing_matrix.ts prints the service levels you can subscribe to.4
Book a fixture
book_fixture.ts lists bookable fixtures, requests a quote, and books one fixture. It skips booking when the wallet already holds the ticket.5
Validate on-chain
V1_stat_validation_v4.ts and V1_odds_validation_v4.ts run the V4 validation sequence against a booked fixture. Both book the fixture first if the wallet has no ticket for it.fixture_validation_view_only.ts and historical_scores.ts subscribe on their own and need no booking, so they can run at any point.
Script Index
subscription_free_tier.ts, V1_stat_validation_v4.ts, and V1_odds_validation_v4.ts keep running for about an hour after their main work, to show streamed updates. Once the validation results or snapshots are printed, stop the script with Ctrl+C.Choosing Fixtures
V1_odds_validation_v4.tsonly picks odds updates for fixtures listed byGET /api/fixtures-schedulein the NFL or the Premier League. Edit theallowedCompetitionIdsset in the script to target other bookable competitions.V1_stat_validation_v4.tsvalidates a fixture ID set in the script. Change it to a fixture fromGET /api/fixtures-schedule. The strategies labelled “calibrated” expect particular stat values, so they returnfalseon other fixtures. A confirmed transaction returnsfalsewhen the predicate does not hold and also when the proof does not match the published root.book_fixture.tsbooks the fixture inFIXTURE_ID, or a default set in the script.
examples/devnet/common:
Validation Paths
Final Outcome and Fixtures
On the current devnet and mainnet releases, final scores records useaction=game_finalised with statusId=100 and period=100. Use those records when validating or settling the final match outcome, regardless of whether the match ended after regulation time, extra time, penalties, or abandonment.
Fixture payloads include a backward-compatible GameState field. Current values are:
Use
fixture_validation_view_only.ts for the runnable fixture proof flow. The script demonstrates fetching fixture validation data, deriving the ten-day fixture roots PDA, and simulating validateFixture.