Enums
- TypeScript
- Python
enum MarketStatus {
Open = "open",
Resolved = "resolved",
Disputed = "disputed",
}
enum DisputeStatus {
Voting = "voting",
Active = "active",
Resolved = "resolved",
Expired = "expired",
}
class MarketStatus(Enum):
OPEN = "open"
RESOLVED = "resolved"
DISPUTED = "disputed"
class DisputeStatus(Enum):
VOTING = "voting"
ACTIVE = "active"
RESOLVED = "resolved"
EXPIRED = "expired"
class OutcomeType(Enum):
INDEX = "index"
UNRESOLVABLE = "unresolvable"
Account Types
GlobalState
- TypeScript
- Python
interface GlobalState {
authority: PublicKey;
admins: PublicKey[];
creationFee: BN;
authorityTradingFeeBps: number;
creatorTradingFeeBps: number;
redemptionFeeBps: number;
usdcMint: PublicKey;
feeVault: PublicKey;
marketCount: BN;
bump: number;
feeVaultBump: number;
}
@dataclass
class GlobalState:
authority: Pubkey
admins: list[Pubkey]
creation_fee: int
authority_trading_fee_bps: int
creator_trading_fee_bps: int
redemption_fee_bps: int
usdc_mint: Pubkey
fee_vault: Pubkey
market_count: int
bump: int
fee_vault_bump: int
Market
- TypeScript
- Python
interface Market {
id: BN;
creator: PublicKey;
question: string;
metadataUri: string;
closeTime: BN;
createdAt: BN;
status: MarketStatus;
outcomeCount: number;
pools: BN[];
supplies: BN[];
optionNames: string[];
resolution: Resolution | null;
resolutionMetadataUri: string | null;
disputeThresholdMet: boolean;
bump: number;
vaultBump: number;
creatorFeeVault: PublicKey;
}
@dataclass
class Market:
id: int
creator: Pubkey
question: str
metadata_uri: str
close_time: int
created_at: int
status: MarketStatus
outcome_count: int
pools: list[int]
supplies: list[int]
option_names: list[str]
resolution: Resolution | None
resolution_metadata_uri: str | None
dispute_threshold_met: bool
bump: int
vault_bump: int
creator_fee_vault: Pubkey
Position
- TypeScript
- Python
interface Position {
market: PublicKey;
user: PublicKey;
outcomeAmounts: BN[];
bump: number;
}
@dataclass
class Position:
market: Pubkey
user: Pubkey
outcome_amounts: list[int]
bump: int
Dispute
- TypeScript
- Python
interface Dispute {
market: PublicKey;
marketId: BN;
openedAt: BN;
status: DisputeStatus;
totalPoolWeight: BN;
totalNoWeight: BN;
votesForDispute: BN;
messageCount: number;
resolvedBy: PublicKey | null;
finalOutcome: Outcome | null;
bump: number;
}
@dataclass
class Dispute:
market: Pubkey
market_id: int
opened_at: int
status: DisputeStatus
total_pool_weight: int
total_no_weight: int
votes_for_dispute: int
message_count: int
resolved_by: Pubkey | None
final_outcome: Outcome | None
bump: int
DisputeVote
- TypeScript
- Python
interface DisputeVote {
dispute: PublicKey;
user: PublicKey;
weight: BN;
bump: number;
}
@dataclass
class DisputeVote:
dispute: Pubkey
user: Pubkey
weight: int
bump: int
DisputeMessage
- TypeScript
- Python
interface DisputeMessage {
dispute: PublicKey;
author: PublicKey;
parentMessage: PublicKey | null;
messageHash: number[];
content: string;
timestamp: BN;
authorWeight: BN;
boostAmount: BN;
isAdmin: boolean;
bump: number;
}
@dataclass
class DisputeMessage:
dispute: Pubkey
author: Pubkey
parent_message: Pubkey | None
message_hash: bytes
ipfs_uri: str
timestamp: int
author_weight: int
boost_amount: int
is_admin: bool
bump: int
BoostRecord
- TypeScript
- Python
interface BoostRecord {
message: PublicKey;
booster: PublicKey;
amount: BN;
bump: number;
}
@dataclass
class BoostRecord:
message: Pubkey
booster: Pubkey
amount: int
bump: int
DisputeConfig
- TypeScript
- Python
interface DisputeConfig {
marketProgramId: PublicKey;
minPoolForDispute: BN;
bump: number;
}
@dataclass
class DisputeConfig:
market_program_id: Pubkey
min_pool_for_dispute: int
bump: int
Outcome Types
- TypeScript
- Python
type Outcome =
| { index: { index: number } }
| { unresolvable: {} };
interface Resolution {
outcome: Outcome;
resolvedAt: BN;
resolver: PublicKey;
}
@dataclass
class Outcome:
outcome_type: OutcomeType
index: int | None = None
@dataclass
class Resolution:
outcome: Outcome
resolved_at: int
resolver: Pubkey
Metadata Types (TypeScript)
interface MarketMetadata {
question: string;
options: string[];
resolution_method: string;
close_date: number;
reasoning: string;
image_url: string | null;
image_ipfs_hash: string | null;
creator: string;
created_at: number;
}
interface MarketWithMetadata {
publicKey: PublicKey;
account: Market;
metadata: MarketMetadata | null;
}
Configuration Types
- TypeScript
- Python
interface OricaSDKConfig {
connection: Connection;
oricaProgramId?: PublicKey;
disputesProgramId?: PublicKey;
oricaIdl: any;
disputesIdl: any;
}
interface FetchOptions {
includeMetadata?: boolean;
metadataTimeout?: number;
}
interface BuildOptions {
computeUnits?: number;
}
# SDK initialization parameters
connection: AsyncClient
orica_program_id: Pubkey | None
disputes_program_id: Pubkey | None
wallet: Wallet | None
Importing Types
- TypeScript
- Python
import type {
Market,
Position,
Dispute,
DisputeVote,
DisputeMessage,
MarketMetadata,
MarketWithMetadata,
FetchOptions,
BuildOptions,
MarketStatus,
DisputeStatus,
} from "@neko/orica-sdk";
from orica_sdk import (
# Types
GlobalState,
Market,
Position,
DisputeConfig,
Dispute,
DisputeVote,
DisputeMessage,
BoostRecord,
# Enums
MarketStatus,
DisputeStatus,
OutcomeType,
# Outcome
Outcome,
Resolution,
)