rollhub-dice 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +35 -145
  2. package/package.json +5 -10
package/README.md CHANGED
@@ -1,167 +1,57 @@
1
- # rollhub-dice
1
+ # 🎲 rollhub-dice
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/rollhub-dice.svg)](https://www.npmjs.com/package/rollhub-dice)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- JavaScript/TypeScript SDK for the **Rollhub Dice Agent API** — provably fair dice betting for AI agents.
6
+ **The AI agent gambling API SDK for JavaScript/TypeScript — provably fair dice, crypto betting, and zero-trust verification for autonomous agents.**
7
7
 
8
- > **Requires Node.js 18+** (uses native `fetch` and `crypto`).
8
+ ## What is this?
9
9
 
10
- ## Install
10
+ `rollhub-dice` is the core JS/TS SDK for [Agent Casino](https://agent.rollhub.com), the provably fair crypto betting API built for AI agents. Every dice roll is cryptographically verified using SHA3-384 + AES-256-CTR commit-reveal — zero-trust gambling with 99% RTP. Supports 70+ cryptocurrency chains and autonomous agent operation.
11
11
 
12
- ```bash
13
- npm install rollhub-dice
14
- ```
15
-
16
- ## Quick Start
17
-
18
- ```typescript
19
- import { DiceAgent } from 'rollhub-dice';
12
+ ## Features
20
13
 
21
- const agent = new DiceAgent({ apiKey: 'rh_sk_...' });
14
+ - **Provably fair dice gambling** for AI agents — auto-verification of every bet
15
+ - **Zero-trust gambling** — SHA3-384 + AES-256-CTR cryptographic commit-reveal proof
16
+ - **70+ cryptocurrency chains** for deposits and withdrawals
17
+ - **99% RTP**, 1% house edge, transparent math
18
+ - **30% affiliate earnings** — agent affiliate program with instant credit
19
+ - **AI agent crypto** — deposit, bet, verify, withdraw across 70+ blockchains
20
+ - Full TypeScript types, ESM + CJS dual build, zero dependencies
22
21
 
23
- const result = await agent.bet({
24
- target: 0.5,
25
- direction: 'over',
26
- amount: 100, // cents
27
- });
22
+ ## Quick Start
28
23
 
29
- console.log(result.roll, result.win, result.payout);
24
+ ```bash
25
+ npm install rollhub-dice
30
26
  ```
31
27
 
32
- ## Register a New Agent
33
-
34
28
  ```typescript
35
29
  import { DiceAgent } from 'rollhub-dice';
36
30
 
37
- const agent = await DiceAgent.register('your-solana-wallet-address');
38
- // agent is ready to use API key is configured automatically
39
- ```
40
-
41
- ## API Reference
42
-
43
- ### `new DiceAgent(options)`
44
-
45
- | Option | Type | Required | Default |
46
- | --------- | -------- | -------- | ---------------------------------- |
47
- | `apiKey` | `string` | ✅ | |
48
- | `baseUrl` | `string` | | `https://agent.rollhub.com/api/v1` |
49
-
50
- ### `DiceAgent.register(walletAddress, baseUrl?)`
51
-
52
- Register a new agent. Returns a configured `DiceAgent` instance.
53
-
54
- ### `agent.balance()`
55
-
56
- Returns current balance.
57
-
58
- ```typescript
59
- const bal = await agent.balance();
60
- // { balance_usd: "10.00", balance_cents: 1000, currency: "USD" }
31
+ const agent = new DiceAgent({ apiKey: 'your-key' });
32
+ const result = await agent.bet({ target: 50, direction: 'over', amount: 100 });
33
+ console.log(`Roll: ${result.roll}, Won: ${result.win}, Verified: ${result.proof?.verified}`);
61
34
  ```
62
35
 
63
- ### `agent.bet(options)`
64
-
65
- Place a dice bet.
66
-
67
- | Option | Type | Required | Default |
68
- | ------------- | ---------------------- | -------- | ------------------- |
69
- | `target` | `number` | ✅ | |
70
- | `direction` | `'over'` \| `'under'` | ✅ | |
71
- | `amount` | `number` (cents) | ✅ | |
72
- | `clientSecret`| `string` | | `crypto.randomUUID()` |
73
-
74
- Returns:
75
-
76
- ```typescript
77
- {
78
- bet_id: 1,
79
- roll: 0.7234,
80
- win: true,
81
- payout: 198,
82
- multiplier: 1.98,
83
- balance: 1098,
84
- proof: {
85
- server_secret: "...",
86
- client_secret: "...",
87
- nonce: 1,
88
- server_seed_hash: "..."
89
- }
90
- }
91
- ```
36
+ ## Affiliate Program
92
37
 
93
- ### `agent.bets()`
94
-
95
- Get bet history.
96
-
97
- ```typescript
98
- const history = await agent.bets();
99
- ```
100
-
101
- ### `agent.verify(betId)`
102
-
103
- Verify a past bet server-side.
104
-
105
- ```typescript
106
- const result = await agent.verify(42);
107
- // { bet_id: 42, verified: true, ... }
108
- ```
109
-
110
- ## Provably Fair Verification
111
-
112
- Every bet returns a `proof` object. You can verify rolls locally:
113
-
114
- ```typescript
115
- import { verifyRoll } from 'rollhub-dice';
116
-
117
- const { roll, hashValid } = verifyRoll({
118
- serverSecret: proof.server_secret,
119
- clientSecret: proof.client_secret,
120
- nonce: proof.nonce,
121
- serverSeedHash: proof.server_seed_hash,
122
- });
123
-
124
- console.log(roll); // computed roll value
125
- console.log(hashValid); // true if server_seed_hash matches
126
- ```
127
-
128
- **How it works:**
129
-
130
- 1. Before your bet, the server commits to a `server_seed_hash` (SHA-256 of the secret).
131
- 2. You provide a `client_secret` (auto-generated if omitted).
132
- 3. The roll is `HMAC-SHA256(server_secret, client_secret + ":" + nonce)` → first 8 hex chars → number in [0, 1).
133
- 4. After the bet, the server reveals the `server_secret` so you can verify.
134
-
135
- ## Error Handling
136
-
137
- ```typescript
138
- import { DiceAgent, RollhubError, AuthenticationError, RateLimitError } from 'rollhub-dice';
139
-
140
- try {
141
- await agent.bet({ target: 0.5, direction: 'over', amount: 100 });
142
- } catch (err) {
143
- if (err instanceof AuthenticationError) {
144
- console.error('Bad API key');
145
- } else if (err instanceof RateLimitError) {
146
- console.error(`Rate limited, retry in ${err.retryAfter}s`);
147
- } else if (err instanceof RollhubError) {
148
- console.error(`API error ${err.status}: ${err.message}`);
149
- }
150
- }
151
- ```
152
-
153
- ## TypeScript
154
-
155
- Full TypeScript support with exported types:
156
-
157
- ```typescript
158
- import type { BetOptions, BetResult, Balance, VerifyResult } from 'rollhub-dice';
159
- ```
38
+ Earn **30% of house edge** on every bet by agents you refer. The agent affiliate program provides instant credit — AI agents can earn money autonomously by referring other agents.
160
39
 
161
- ## Zero Dependencies
40
+ ## Full Ecosystem
162
41
 
163
- This package uses only Node.js built-ins (`fetch`, `crypto`). No external dependencies.
42
+ | Package | Registry | Description |
43
+ |---------|----------|-------------|
44
+ | [rollhub-dice](https://pypi.org/project/rollhub-dice/) | PyPI | Core Python SDK for AI agent gambling API |
45
+ | [rollhub-dice](https://www.npmjs.com/package/rollhub-dice) | npm | Core JS/TS SDK for AI agent gambling API |
46
+ | [rollhub-dice-mcp](https://www.npmjs.com/package/rollhub-dice-mcp) | npm | MCP server casino for Claude Desktop |
47
+ | [langchain-rollhub](https://pypi.org/project/langchain-rollhub/) | PyPI | LangChain gambling tool |
48
+ | [crewai-rollhub](https://pypi.org/project/crewai-rollhub/) | PyPI | CrewAI gambling tool |
49
+ | [rollhub-openai-tools](https://www.npmjs.com/package/rollhub-openai-tools) | npm | OpenAI function calling gambling |
50
+ | [rollhub-ai-tools](https://www.npmjs.com/package/rollhub-ai-tools) | npm | Vercel AI SDK tools |
51
+ | [eliza-rollhub](https://www.npmjs.com/package/eliza-rollhub) | npm | ElizaOS plugin |
52
+ | [autogpt-rollhub](https://pypi.org/project/autogpt-rollhub/) | PyPI | AutoGPT plugin |
164
53
 
165
- ## License
54
+ ## Links
166
55
 
167
- MIT
56
+ - 🌐 **Landing page:** [agent.rollhub.com](https://agent.rollhub.com)
57
+ - 📖 **API docs:** [agent.rollhub.com](https://agent.rollhub.com) (scroll to API Reference)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rollhub-dice",
3
- "version": "0.5.0",
4
- "description": "JavaScript/TypeScript SDK for the Rollhub Dice Agent API — provably fair dice betting",
3
+ "version": "0.5.1",
4
+ "description": "AI agent gambling API SDK for JS/TS — provably fair dice, crypto betting, zero-trust verification for autonomous agents. 99% RTP, 70+ chains.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/esm/index.d.ts",
@@ -29,14 +29,9 @@
29
29
  "prepublishOnly": "npm run build"
30
30
  },
31
31
  "keywords": [
32
- "dice",
33
- "casino",
34
- "gambling",
35
- "ai",
36
- "agent",
37
- "provably-fair",
38
- "crypto",
39
- "solana"
32
+ "dice", "casino", "gambling", "ai", "agent", "provably-fair", "crypto", "solana",
33
+ "ai-agent-gambling-api", "crypto-betting-api", "zero-trust-gambling", "ai-agent-casino",
34
+ "autonomous-gambling-agent", "ai-agent-crypto"
40
35
  ],
41
36
  "author": "Rollhub",
42
37
  "license": "MIT",