open-index/open-npm huggingface dataset:
npm package: @predixlive/sdk
Description: TypeScript SDK for Predix prediction market — agent-native BTC trading
Author: Predix
Latest version: 0.1.1

# @predixlive/sdk

TypeScript SDK for [Predix](https://www.predix.live) — the first agent-native prediction market on Bitcoin.

> **Testnet only.** All tokens are free test tokens with no real value.

## Install

```bash
npm install @predixlive/sdk
```

## Quick Start

```typescript
import { PredixClient } from '@predixlive/sdk'

const client = new PredixClient({
  privateKey: 'your_stacks_private_key_hex', // auto-registers for an API key
})

// --- First-time setup (testnet) ---
// 1. Mint free test tokens
await client.mint()
// 2. Approve the contract to spend your tokens (once)
await client.approve()
// Wait ~30-60s for both txs to confirm on testnet

// --- Trading ---
// Check market state
const market = await client.market()
console.log(`Round ${market.round.id}: ${market.round.pool.totalVolume} USD volume`)

// Place a bet
const result = await client.bet('UP', 5)
console.log(`Bet placed: ${result.txid}`)

// Wait for automatic settlement
const resolution = await client.waitForResolution(result.roundId)
console.log(`Outcome: ${resolution.outcome}, P&L: ${resolution.pnl}`)
```

## First-Time Setup (Testnet)

Before placing bets, your agent needs two one-time steps:

1. **`client.mint()`** — Mint free USDCx test tokens (testnet only, no real value)
2. **`client.approve()`** — Approve the Predix contract to spend your USDCx

Both are sponsored transactions (zero gas). Wait ~30-60s for confirmation after each.

## API

### Read Methods (no private key needed)
- `client.market()` — Current round, pools, odds, prices
- `client.opportunities()` — Trading signals, imbalance, streaks
- `client.positions()` — Active bets, pending rounds, balance
- `client.history()` — Win rate, P&L, ROI, bet history

### Write Methods (requires private key)
- `client.bet(side, amount)` — Place bet (UP/DOWN, min $1)
- `client.mint()` — Mint free test USDCx (testnet only)
- `client.approve()` — Approve token spending (once)

### Utilities
- `client.waitForResolution(roundId)` — Poll until settled
- `client.stream()` — Async iterator for live market data

## Configuration

```typescript
const client = new PredixClient({
  privateKey: 'hex...',       // Required for trading. Signs locally, never sent to server.
  apiKey: 'pk_live_...',      // Optional. Auto-generated from privateKey if omitted.
  baseUrl: 'https://...',     // Optional. Default: https://www.predix.live
  network: 'testnet',         // Optional. Default: testnet
})
```

## Security

All signing happens locally. The private key is never transmitted to the server. Transactions are built unsigned by the platform, signed on your machine, and submitted for gas-free sponsorship.

## Links

- [Documentation](https://www.predix.live/docs/agents)
- [MCP Server](https://www.npmjs.com/package/@predixlive/mcp)
- [OpenAPI Spec](https://www.predix.live/openapi.json)

## License

MIT
npm package: @predragnikolic/p18n
Description: Script to generate translations files from local or remote csv.
Latest version: 0.0.4

# p18n

Generate translation files based on a CSV file.

### Configuration

Add a `translate` script in package.json:

Remote CSV example:
```jsonc
{
  "scripts": {
    "translate": "p18n --locales=en,sr,de --out=./i18n/messages --in='https://docs.google.com/spreadsheets/d/1PWfDNHxkEBRknzssW5T7ihaiXDQFndJtxBr8AbWUxcU/gviz/tq?tqx=out:csv&gid=0'"
  }
}
```
> NOTE: when using google docs, make sure to make the sheet publicly available for reading.

Local CSV example:
```jsonc
{
  "scripts": {
    "translate": "p18n --locales=en,sr,de --out=./i18n/messages --in=./translations.csv",
  }
}
```

Then run `npm run translate`. That will generate the translation files in the `--out` directory.

# Help

Run `npx p18n` to get docs for the available commands.
npm package: @predragnikolic/pn-show-db
Description: This is a tool to visualize your database tables.
Latest version: 0.4.3

# @predragnikolic/pn-show-db

This is a tool to visualize your database tables.

<img height="402" src="https://github.com/predragnikolic/predragnikolic.github.io/assets/22029477/57b18467-b67b-41b7-8b5d-0adfa6332eaf" />

## Getting started

1. Create a `.env` file.
2. Specify the `DATABASE_URL` connection string. It should look like this:
```
DATABASE_URL=postgres://user:password@host:5432/database
```
3. From the root folder where the `.env` file is present,
run:
```
npx @predragnikolic/pn-show-db --db=postgres
```
That will open a browser and visualize your database.

> NOTE: Only Postgres is supported.

# Generate SQL code with a local Ollama model

See this [article](https://predrag.pro/blog/visualize-your-database.html#setup-ollama-phi) on how to setup `Ollama` with `phi3`.
npm package: @predragnikolic/vite-validate-env
Description: Script to gen erate translations files from local or remote csv.
Latest version: 0.0.6

# vite-validate-env

Validate Vite env with Zod.

# Setup

Update `vite.config.ts` with:

```ts
import { viteValidateEnv } from "@predragnikolic/vite-validate-env"
import z from "zod"


export default defineConfig({
  plugins: [
    viteValidateEnv(z.object({
      VITE_BASE_URL: z.string()
    }))
  ]
})
```