OddMaki
Customization

SDK Reference

TypeScript SDK for OddMaki — create venues, manage markets, place orders, and build custom UIs.

The @oddmaki/sdk provides a typed TypeScript client for interacting with the OddMaki protocol on Base.

Installation

pnpm add @oddmaki/sdk

Peer dependencies: viem, @wagmi/core.

Client Setup

import { createOddMakiClient } from '@oddmaki/sdk';
import { baseSepolia } from 'viem/chains';
import { http } from 'viem';

const client = createOddMakiClient({
  walletClient,           // from wagmi useWalletClient()
  chain: baseSepolia,
  transport: http(),
});

The client exposes seven modules: venue, market, trade, accessControl, public, token, and uma.

Modules

Venue Module

MethodDescription
client.venue.createVenue(params)Create a new venue
client.venue.updateVenue(params)Update name, metadata, access control, fee recipient
client.venue.updateFees(params)Update trading fee tiers
client.venue.updateOracleParams(params)Update UMA reward and min bond
client.venue.setPaused(venueId, paused)Pause/unpause a venue
client.venue.getVenue(venueId)Read full venue configuration
client.venue.canTrade(user, venueId)Check venue-level trading access
client.venue.canCreateMarket(user, venueId)Check venue-level creation access

Market Module

MethodDescription
client.market.createMarket(params)Create a binary market
client.market.createMarketGroup(params)Create a market group
client.market.addMarketToGroup(params)Add an outcome to a group
client.market.activateMarketGroup(params)Activate a market group for trading
client.market.addPlaceholderMarkets(params)Reserve slots for late additions
client.market.activatePlaceholder(params)Activate a placeholder with real data
client.market.convertPositions(params)NegRisk position conversion

Trade Module

MethodDescription
client.trade.placeOrder(params)Place a limit order (raw BigInt)
client.trade.placeOrderSimple(params)Place a limit order (formatted inputs)
client.trade.cancelOrder(orderId)Cancel a resting order
client.trade.placeMarketOrder(params)Place a market order (raw BigInt)
client.trade.placeMarketOrderSimple(params)Place a market order (formatted inputs)
client.trade.previewMarketOrder(params)Simulate a market order
client.trade.matchOrders(params)Trigger order matching
client.trade.splitPosition(marketId, amount)Split collateral into YES + NO tokens
client.trade.mergePositions(marketId, amount)Merge YES + NO tokens into collateral
client.trade.getOrder(orderId)Read a single order
client.trade.getOrderBook(params)Get top-of-book summary
client.trade.getTickLevel(params)Get tick level detail

UMA Module

MethodDescription
client.uma.assertMarketOutcome(params)Assert an outcome with bond
client.uma.settleAssertion(assertionId)Settle after liveness
client.uma.reportResolution(params)Report outcome to CTF
client.uma.redeemWinnings(marketId)Redeem winning tokens
client.uma.getMarketStatus(marketId)Get resolution phase and state
client.uma.getQuestionData(marketId)Get oracle config
client.uma.getAssertionDetails(assertionId)Get UMA assertion details
client.uma.getResolutionStatus(marketId)Get CTF resolution state

AccessControl Module

Deploy pre-built access control contracts, configure market-level overrides, and manage whitelists.

MethodDescription
client.accessControl.deployWhitelist()Deploy a WhitelistAccessControl (caller becomes owner)
client.accessControl.deployTokenGated(params)Deploy a TokenGatedAccessControl (ERC-20 balance check)
client.accessControl.deployNFTGated(params)Deploy an NFTGatedAccessControl (ERC-721 / ERC-1155)
client.accessControl.setMarketTradingAC(params)Set trading AC for a specific market (operator only)
client.accessControl.removeMarketTradingAC(params)Remove market-level trading AC override (operator only)
client.accessControl.canTradeOnMarket(params)Check if a user can trade on a market
client.accessControl.getMarketTradingAC(params)Get market-level AC contract address
client.accessControl.addToWhitelist(params)Add addresses to a whitelist (owner only)
client.accessControl.removeFromWhitelist(params)Remove addresses from a whitelist (owner only)
client.accessControl.isWhitelisted(params)Check if a user is on a whitelist

Factory methods return a transaction hash. Extract the deployed contract address from the AccessControlDeployed event in the receipt logs. Whitelist methods call the WhitelistAccessControl contract directly, not through the Diamond.

Public Module

Read-only queries via the subgraph:

MethodDescription
client.public.getVenues(params)List venues
client.public.getTopVenues(first)Top venues by volume
client.public.getOrders(params)Query orders for a market
client.public.getTradeHistory(params)Trade history for a market
client.public.getTopOfBook(marketId)Top-of-book data
client.public.getRecentTrades(params)Recent trades across markets

Conversion Utilities

import {
  priceToTick,
  tickToPrice,
  parseTokenAmount,
  formatAmount,
  createExpiry,
} from '@oddmaki/sdk';

priceToTick('0.75');                     // → 75n
tickToPrice(75n);                        // → "0.75"
parseTokenAmount('100.5', 6);            // → 100500000n (USDC, 6 decimals)
formatAmount(100500000n, 6);             // → "100.5"
createExpiry('24h');                     // → BigInt(now + 86400)
createExpiry('gtc');                     // → 0n

Approvals

Most write operations require prior token approvals:

OperationApproval Required
Limit order (BUY)USDC.approve(diamond, amount)
Limit order (SELL)CTF.setApprovalForAll(diamond, true)
Market order (BUY)USDC.approve(diamond, amount)
Split positionUSDC.approve(diamond, amount)
Merge positionsCTF.setApprovalForAll(diamond, true)

The Simple variants (e.g., placeOrderSimple) handle approvals automatically when possible.

What's Next