@1upmonster/duel 0.1.0 → 0.1.2

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 +90 -0
  2. package/package.json +2 -1
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @1upmonster/duel
2
+
3
+ TypeScript SDK for **Duel** - a privacy-focused matchmaking protocol on Solana using MagicBlock's Ephemeral Rollups (TEE).
4
+
5
+ ## Features
6
+
7
+ - **Privacy-First**: Player ELO and queue status hidden in TEE
8
+ - **Client-Side**: Players join queues directly from their wallets (no CPI required)
9
+ - **Automatic Matching**: TEE processes matches based on ELO windows
10
+ - **Easy Integration**: Simple SDK for both game owners and players
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @1upmonster/duel
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ### For Game Owners
21
+
22
+ Initialize matchmaking infrastructure for your game:
23
+
24
+ ```typescript
25
+ import { MatchmakingAdmin } from "@1upmonster/duel";
26
+ import { AnchorProvider } from "@coral-xyz/anchor";
27
+
28
+ const admin = new MatchmakingAdmin(provider);
29
+
30
+ // 1. Initialize Tenant for your Game Program
31
+ // Args: authority, tenantProgramId, eloWindow (default 100), eloOffset (default 40)
32
+ await admin.initializeTenant(authority, gameProgramId, 200, 40);
33
+
34
+ // 2. Initialize a Matchmaking Queue
35
+ const tenantPda = admin.getTenantPda(authority);
36
+ await admin.initializeQueue(authority, tenantPda);
37
+
38
+ // 3. Delegate Queue to TEE Validator
39
+ await admin.delegateQueue(authority, validatorPubkey);
40
+ ```
41
+
42
+ ### For Players
43
+
44
+ Join the private matchmaking queue:
45
+
46
+ ```typescript
47
+ import { MatchmakingPlayer } from "@1upmonster/duel";
48
+
49
+ const player = new MatchmakingPlayer(provider);
50
+
51
+ // Join queue (matching happens automatically in TEE)
52
+ await player.joinQueue(queuePda, tenantPda, playerProfilePda);
53
+ ```
54
+
55
+ ## API Reference
56
+
57
+ ### `MatchmakingAdmin`
58
+
59
+ **Constructor**
60
+ - `new MatchmakingAdmin(provider: AnchorProvider, programId?: PublicKey)`
61
+
62
+ **Methods**
63
+ - `initializeTenant(authority, tenantProgramId, eloWindow?, eloOffset?)` - Set up game tenant
64
+ - `initializeQueue(authority, tenant)` - Create matchmaking queue
65
+ - `delegateQueue(authority, validator?)` - Delegate to TEE validator
66
+ - `getTenantPda(authority)` - Derive tenant PDA
67
+ - `getQueuePda(authority)` - Derive queue PDA
68
+
69
+ ### `MatchmakingPlayer`
70
+
71
+ **Constructor**
72
+ - `new MatchmakingPlayer(provider: AnchorProvider, programId?: PublicKey)`
73
+
74
+ **Methods**
75
+ - `joinQueue(queue, tenant, playerData)` - Join matchmaking queue
76
+
77
+ ## How It Works
78
+
79
+ 1. **Queue Joining**: Players call `joinQueue` directly via SDK
80
+ 2. **Matching**: TEE automatically processes matches based on ELO windows
81
+ 3. **Privacy**: Queue state is only visible within the TEE, not on L1
82
+
83
+ ## Links
84
+
85
+ - [GitHub Repository](https://github.com/val-samonte/private-matchmaking)
86
+ - [Full Documentation](https://github.com/val-samonte/private-matchmaking#readme)
87
+
88
+ ## License
89
+
90
+ MIT
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@1upmonster/duel",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "SDK for Private Matchmaking on Solana",
5
+ "license": "MIT",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "https://github.com/val-samonte/private-matchmaking"