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

@tevalabs/xelma-bindings

v1.0.0

Published

TypeScript bindings for Xelma prediction market smart contract on Stellar/Soroban

Downloads

158

Readme

Xelma - Decentralized XLM Price Prediction Market

TypeScript Bindings for Xelma Smart Contract

🎯 What is Xelma?

Xelma is a decentralized prediction market built on the Stellar blockchain (Soroban) that allows users to bet on XLM price movements. It combines the excitement of price prediction with blockchain transparency and fairness.

🔥 Problem We're Solving

Traditional Prediction Markets Are:

  • Centralized - Single point of failure, can be shut down
  • Opaque - Users can't verify fair payouts or manipulation
  • High barriers - Require KYC, bank accounts, or specific payment methods
  • Slow payouts - Days or weeks to withdraw winnings
  • Trust-based - You must trust the operator won't steal funds

Xelma Solves This With:

  • Decentralized - Runs on Stellar blockchain, unstoppable
  • Transparent - All bets, rounds, and payouts are on-chain and verifiable
  • Permissionless - Anyone with a Stellar wallet can participate
  • Instant payouts - Claim winnings immediately after round resolution
  • Trustless - Smart contract logic ensures fair, automated payouts
  • Low fees - Stellar's minimal transaction costs (~0.00001 XLM)

🎮 How It Works

For Users (Bettors):

  1. Get Virtual Tokens - Receive 1000 vXLM (virtual XLM) on first interaction
  2. Join Active Round - Place bets on whether XLM price will go UP or DOWN
  3. Wait for Resolution - Oracle resolves round with actual price data
  4. Claim Winnings - Winners split the losing pool proportionally
  5. Track Performance - View your win/loss stats and streaks

For Admins:

  • Create Rounds - Set start price and duration (e.g., 60 ledgers ≈ 5 minutes)
  • Manage System - One-time initialization of contract

For Oracles:

  • Resolve Rounds - Submit final XLM price from trusted data source
  • Trigger Payouts - Smart contract automatically calculates and distributes winnings

🏗️ Architecture

┌─────────────────┐
│   Frontend      │  ← React/Next.js UI
│   (React App)   │
└────────┬────────┘
         │ imports @tevalabs/xelma-bindings
         ↓
┌─────────────────┐
│   Bindings      │  ← This package (TypeScript types + client)
│  (TS Library)   │
└────────┬────────┘
         │ calls via Stellar SDK
         ↓
┌─────────────────┐
│ Smart Contract  │  ← Rust/Soroban contract on Stellar
│   (Blockchain)  │
└─────────────────┘

💡 Key Features

Virtual Token System

  • 1000 vXLM initial balance per user
  • No real money required to start
  • Balance tracked on-chain

Fair Proportional Payouts

Winner's Payout = Their Bet + (Their Bet / Winning Pool) × Losing Pool

Example:
- Alice bets 100 vXLM UP, Bob bets 200 vXLM UP (Total UP: 300)
- Charlie bets 150 vXLM DOWN (Total DOWN: 150)
- Price goes UP → Alice and Bob win
- Alice gets: 100 + (100/300) × 150 = 150 vXLM (50% profit)
- Bob gets: 200 + (200/300) × 150 = 300 vXLM (50% profit)

Security Features

  • Role-based access - Admin, Oracle, User permissions
  • Overflow protection - Checked arithmetic prevents exploits
  • Input validation - All parameters validated before execution
  • One bet per round - Prevents double-betting attacks
  • Claim-based withdrawal - Users control when to claim winnings

User Statistics

  • Total wins / losses
  • Current winning streak
  • Best streak ever achieved

📦 Using These Bindings

Installation

```bash npm install @tevalabs/xelma-bindings

or

yarn add @tevalabs/xelma-bindings ```

Quick Start

```typescript import { Client, BetSide } from '@tevalabs/xelma-bindings';

// Initialize client const client = new Client({ contractId: 'YOUR_CONTRACT_ID', networkPassphrase: Networks.TESTNET, rpcUrl: 'https://soroban-testnet.stellar.org' });

// Mint initial tokens await client.mint_initial({ user: userAddress });

// Check balance const balance = await client.balance({ user: userAddress }); console.log('Balance:', balance); // 10000000000 (1000 vXLM in stroops)

// Get active round const round = await client.get_active_round(); if (round) { console.log('Start price:', round.price_start); console.log('UP pool:', round.pool_up); console.log('DOWN pool:', round.pool_down); }

// Place a bet await client.place_bet({ user: userAddress, amount: 100_0000000n, // 100 vXLM side: BetSide.Up });

// Check stats const stats = await client.get_user_stats({ user: userAddress }); console.log('Wins:', stats.total_wins); console.log('Current streak:', stats.current_streak);

// Claim winnings const claimed = await client.claim_winnings({ user: userAddress }); console.log('Claimed:', claimed); ```

🛠️ Development Setup

Install Dependencies

```bash npm install

or

yarn install ```

Build TypeScript

```bash npm run build

or

yarn build ```

Type Definitions

All types are exported and fully documented:

```typescript import { Client, // Main contract client BetSide, // Enum: Up | Down Round, // Active round interface UserStats, // User performance stats UserPosition, // User's bet in a round ContractError // Error codes (1-13) } from '@tevalabs/xelma-bindings'; ```

🔗 Related Repositories

🌟 Use Cases

Entertainment

  • Predict XLM price movements in short rounds (5-15 minutes)
  • Compete with friends on leaderboards
  • Track winning streaks

Education

  • Learn about prediction markets without financial risk
  • Understand blockchain interactions
  • Practice trading psychology

Future Extensions

  • Real money markets (with proper licensing)
  • Multiple asset predictions (BTC, ETH, stocks)
  • Longer-term rounds (hours, days)
  • Tournament modes with prizes

🎯 Roadmap

  • [x] Core prediction market contract
  • [x] TypeScript bindings generation
  • [x] Security review and testing (26/26 tests passing)
  • [ ] Frontend UI (React/Next.js)
  • [ ] Oracle service for price feeds
  • [ ] Leaderboard system
  • [ ] Mobile app (React Native)
  • [ ] Mainnet deployment

📄 License

MIT License - See LICENSE file for details

🤝 Contributing

We welcome contributions! Please check the main repository for:

  • Open issues labeled `good-first-issue`
  • Contribution guidelines
  • Code of conduct

📧 Contact

  • GitHub: @TevaLabs
  • Issues: Report bugs or request features in respective repos

Built with ❤️ on Stellar Blockchain