Skip to main content
The repository includes runnable devnet scripts under 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 20 or newer. The current lockfile resolves eventsource@4.1.0, which declares node >=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.
Install dependencies from the repository root:
Run every script from the repository root with the devnet environment values:
Each script’s header comment has the exact command for that script. 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.ts only picks odds updates for fixtures listed by GET /api/fixtures-schedule in the NFL or the Premier League. Edit the allowedCompetitionIds set in the script to target other bookable competitions.
  • V1_stat_validation_v4.ts validates a fixture ID set in the script. Change it to a fixture from GET /api/fixtures-schedule. The strategies labelled “calibrated” expect particular stat values, so they return false on other fixtures. A confirmed transaction returns false when the predicate does not hold and also when the proof does not match the published root.
  • book_fixture.ts books the fixture in FIXTURE_ID, or a default set in the script.
The shared helpers are in examples/devnet/common:

Validation Paths

The fixed fixture IDs in the example scripts are demo fixtures. In production, derive fixtureId, seq, phase, and status from an observed score record from snapshot, updates, historical data, or the scores stream, and book the fixture before validating.

Final Outcome and Fixtures

On the current devnet and mainnet releases, final scores records use action=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.