Skip to main content
All scripts live under scripts/ and run via tsx. They’re typechecked together by pnpm typecheck:scripts (tsc -p scripts), which root pnpm typecheck chains.

Shared conventions

  • Dry-run by default. Every script prints what it would do without --execute.
  • --execute signs + submits.
  • Shared CLI. scripts/lib/cli.ts provides ScriptContext. Loads env, builds SuiClient, derives the keypair from AGENT_KEY / RESOLVER_KEY, parses flags, dry-run-aware signAndExecute, findCreatedObject helpers.
  • All scripts respect .env at repo root.

Grouped

Bootstrap

ScriptPurpose
parse-publish-outputParse sui client publish --json → rewrite .env
create-predict-managerpredict::create_manager + capture id
fund-managerFund PredictManager via predict_manager::deposit<T>
register-trade-agentdarkpool::agent::register_agent
register-marketRegister a price or OO MarketLink
create-seal-policyShare a fresh AccessPolicy (needed after each republish)

Binary event markets

ScriptPurpose
create-binary-marketScaffold → build → publish → create_market → registry.json
finish-create-marketRecovery: finish a half-completed publish from its digest
resolve-binary-marketsettlement::mark_resolved via ResolverCap

DeepBook V3

ScriptPurpose
create-v3-poolsPool<YES,DUSDC> + Pool<NO,DUSDC> (500 DEEP fee each)
seed-v3-liquidityTwo-sided POST_ONLY quotes on both pools, one PTB

Dark-pool vault

ScriptPurpose
create-darkpool-vaultOne PTB: balance_manager::newmint_trade_capdark_pool::create_vault
vault-depositdark_pool::deposit smoke test
keeper-tickVault keeper: pull → mint_pair → BM deposit → record_mint → V3 asks

Predict + smoke

ScriptPurpose
predict-mint-smokeLive predict::mint<T> smoke test
supply-plppredict::supply<T>Coin<PLP> + DarkPool attribution

Optimistic Oracle

ScriptPurpose
oo-proposeoo_resolution::propose<T> with DUSDC bond
oo-finalizefinalize_auto / finalize_vote with clock pre-check

Utility

ScriptPurpose
return-testnet-dusdcDUSDC return sweep (80% commitment)

pnpm aliases

All scripts are wired into root package.json:
{
  "binary-market:create":   "tsx scripts/create-binary-market.ts",
  "binary-market:finish":   "tsx scripts/finish-create-market.ts",
  "binary-market:resolve":  "tsx scripts/resolve-binary-market.ts",
  "predict:new-manager":    "tsx scripts/create-predict-manager.ts",
  "predict:fund":           "tsx scripts/fund-manager.ts",
  "plp:supply":             "tsx scripts/supply-plp.ts",
  "smoke:mint":             "tsx scripts/predict-mint-smoke.ts",
  "market:register":        "tsx scripts/register-market.ts",
  "agent:register":         "tsx scripts/register-trade-agent.ts",
  "oo:propose":             "tsx scripts/oo-propose.ts",
  "oo:finalize":            "tsx scripts/oo-finalize.ts",
  "env:from-publish":       "tsx scripts/parse-publish-output.ts",
  "return-dusdc":           "tsx scripts/return-testnet-dusdc.ts"
}