npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

oxcast-sdk

v1.0.1

Published

JavaScript/TypeScript SDK for interacting with 0xCast prediction markets on Stacks

Readme

@oxcast/sdk

JavaScript/TypeScript SDK for interacting with 0xCast — decentralized prediction markets on Bitcoin via Stacks.

npm version npm downloads License: MIT

Installation

npm install oxcast-sdk @stacks/network @stacks/transactions
yarn add oxcast-sdk @stacks/network @stacks/transactions
pnpm add oxcast-sdk @stacks/network @stacks/transactions

Quick Start

import {
  getContractIdentifier,
  getStacksNetwork,
  calculateOdds,
  formatSTX,
  getTransactionUrl,
} from 'oxcast-sdk';

// Get the market-core contract identifier on mainnet
const marketContract = getContractIdentifier('market-core', 'mainnet');
// => 'SP31PKQVQZVZCK3FM3NH67CGD6G1FMR17VQVS2W5T.market-core'

// Get the Stacks network instance for use with @stacks/transactions
const network = getStacksNetwork('mainnet');

// Calculate odds from pool sizes (in micro-STX)
const odds = calculateOdds(700_000n, 300_000n);
// => { yes: 1.43, no: 3.33, yesImpliedProbability: 0.7, noImpliedProbability: 0.3 }

// Format micro-STX as a readable string
formatSTX(1_500_000n); // => '1.500000 STX'

// Get a Hiro explorer link for a transaction
getTransactionUrl('0xabc123...', 'mainnet');
// => 'https://explorer.hiro.so/txid/0xabc123...?chain=mainnet'

API Reference

Network

| Function | Description | |---|---| | getStacksNetwork(network) | Returns a @stacks/network instance | | getNetworkConfig(network) | Returns API URLs and chain config | | getApiUrl(network) | Returns the Hiro API base URL | | getNodeUrl(network) | Returns the Stacks node API URL | | isValidNetwork(value) | Type guard for NetworkType | | getTransactionUrl(txId, network) | Hiro explorer URL for a transaction | | getAddressUrl(address, network) | Hiro explorer URL for an address | | getContractUrl(identifier, network) | Hiro explorer URL for a contract |

Contracts

| Function | Description | |---|---| | getContractAddress(name, network) | Deployer address for a contract | | getContractIdentifier(name, network) | Fully-qualified address.name string | | getContractPrincipal(name, network) | { address, name, identifier } object | | getAllContracts(network) | Map of all contract identifiers | | CONTRACT_NAMES | Enum of all contract name constants | | CONTRACT_ADDRESSES | Raw address map per network |

Markets

| Function | Description | |---|---| | calculateOdds(yesPool, noPool) | Odds and implied probabilities from pool sizes | | calculatePayout(stake, outcome, yesPool, noPool) | Estimated payout for a stake | | formatSTX(microStx) | Format micro-STX as '1.000000 STX' | | toMicroSTX(stx) | Convert STX number to micro-STX bigint | | fromMicroSTX(microStx) | Convert micro-STX bigint to STX number | | isMarketOpen(market) | Whether a market is accepting predictions | | isMarketResolved(market) | Whether a market has been resolved | | getWinningOutcome(market) | 'Yes', 'No', or null |

Transactions

| Function | Description | |---|---| | formatTransactionType(type) | Human-readable transaction type label | | formatTransactionStatus(status) | Human-readable status label | | getStatusColor(status) | Hex color for a status badge | | getExplorerUrl(txId, network) | Hiro explorer URL for a transaction | | isTerminalStatus(status) | Whether the status is final | | isSuccessful(tx) | Whether the transaction succeeded | | isPending(tx) | Whether the transaction is still pending |

Contract Names

import { CONTRACT_NAMES } from '@oxcast/sdk';

CONTRACT_NAMES.MARKET_CORE      // 'market-core'
CONTRACT_NAMES.OXCAST           // 'oxcast'
CONTRACT_NAMES.GOVERNANCE_CORE  // 'governance-core'
CONTRACT_NAMES.GOVERNANCE_TOKEN // 'governance-token'
CONTRACT_NAMES.LIQUIDITY_POOL   // 'liquidity-pool'
CONTRACT_NAMES.LIQUIDITY_REWARDS // 'liquidity-rewards'
CONTRACT_NAMES.ORACLE_INTEGRATION // 'oracle-integration'
CONTRACT_NAMES.ORACLE_REPUTATION  // 'oracle-reputation'
CONTRACT_NAMES.ACCESS_CONTROL   // 'access-control'
CONTRACT_NAMES.MARKET_FEES      // 'market-fees'
CONTRACT_NAMES.MARKET_MULTI     // 'market-multi'

TypeScript

The SDK is written in TypeScript and ships with full type definitions. No @types/ package needed.

import type { Market, MarketOdds, NetworkType, ContractName } from 'oxcast-sdk';

License

MIT