@rougechain/sdk 0.9.0 → 1.0.0

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 +98 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <strong>Build quantum-safe dApps on RougeChain</strong><br />
11
- Transfers · DEX · NFTs · Shielded Transactions · Bridge · Rollups · Dynamic Fees · Finality Proofs · WebSocket · Mail · Messenger
11
+ Transfers · DEX · NFTs · Social · Shielded Transactions · Bridge · Rollups · Dynamic Fees · Finality Proofs · WebSocket · Mail · Messenger
12
12
  </p>
13
13
 
14
14
  <p align="center">
@@ -62,6 +62,7 @@ const { balance } = await rc.getBalance(wallet.publicKey);
62
62
  | **Shielded** | `rc.shielded` | Private transfers with zk-STARK proofs, shield/unshield XRGE |
63
63
  | **Bridge** | `rc.bridge` | ETH ↔ qETH, USDC ↔ qUSDC, XRGE bridge (Base Mainnet/Sepolia) |
64
64
  | **Rollup** | `rc` | zk-STARK batch proofs, rollup status, submit transfers |
65
+ | **Social** | `rc.social` | Posts, timeline feed, reposts, likes, follows, comments |
65
66
  | **Mail** | `rc.mail` | On-chain encrypted email (`@rouge.quant`) |
66
67
  | **Messenger** | `rc.messenger` | E2E encrypted messaging with self-destruct |
67
68
  | **Address Resolution** | `rc` | O(1) rouge1↔pubkey resolution via on-chain index |
@@ -335,6 +336,79 @@ const batch = await rc.getRollupBatch(1);
335
336
  // { batch_id, transfer_count, proof_size_bytes, proof_time_ms, verified, ... }
336
337
  ```
337
338
 
339
+ ## Social (`rc.social`)
340
+
341
+ On-chain social layer with posts, threaded replies, reposts, likes, follows, and comments. All write operations require a `wallet` parameter for ML-DSA-65 signed requests.
342
+
343
+ ### Posts & Timeline
344
+
345
+ ```typescript
346
+ // Create a post (max 4000 chars)
347
+ const { post } = await rc.social.createPost(wallet, "Hello RougeChain!");
348
+
349
+ // Reply to a post (threaded)
350
+ await rc.social.createPost(wallet, "Great point!", post.id);
351
+
352
+ // Delete your own post
353
+ await rc.social.deletePost(wallet, post.id);
354
+
355
+ // Get a single post with stats
356
+ const result = await rc.social.getPost(post.id, wallet.publicKey);
357
+ // result.post, result.stats { likes, reposts, replies, liked, reposted }
358
+
359
+ // Global timeline (all posts, newest first)
360
+ const timeline = await rc.social.getGlobalTimeline(50, 0);
361
+
362
+ // Following feed (posts from people you follow)
363
+ const feed = await rc.social.getFollowingFeed(wallet, 50, 0);
364
+
365
+ // User's posts
366
+ const { posts, total } = await rc.social.getUserPosts(userPubKey);
367
+
368
+ // Get replies to a post
369
+ const replies = await rc.social.getPostReplies(post.id);
370
+ ```
371
+
372
+ ### Likes, Reposts & Follows
373
+
374
+ ```typescript
375
+ // Like/unlike a post or track (toggle)
376
+ await rc.social.toggleLike(wallet, postOrTrackId);
377
+
378
+ // Repost/unrepost (toggle)
379
+ await rc.social.toggleRepost(wallet, post.id);
380
+
381
+ // Follow/unfollow (toggle)
382
+ await rc.social.toggleFollow(wallet, artistPubKey);
383
+
384
+ // Get stats
385
+ const stats = await rc.social.getPostStats(post.id, wallet.publicKey);
386
+ const artistStats = await rc.social.getArtistStats(pubkey, wallet.publicKey);
387
+ ```
388
+
389
+ ### Comments (Track-level)
390
+
391
+ ```typescript
392
+ // Comment on a track
393
+ const { comment } = await rc.social.postComment(wallet, trackId, "Fire track!");
394
+
395
+ // Get comments
396
+ const comments = await rc.social.getComments(trackId);
397
+
398
+ // Delete your comment
399
+ await rc.social.deleteComment(wallet, comment.id);
400
+ ```
401
+
402
+ ### Play Counts
403
+
404
+ ```typescript
405
+ // Record a play (debounce client-side, one per session per track)
406
+ await rc.social.recordPlay(wallet, trackId);
407
+
408
+ // Get track stats (plays, likes, comments)
409
+ const trackStats = await rc.social.getTrackStats(trackId, wallet.publicKey);
410
+ ```
411
+
338
412
  ## Mail (`rc.mail`)
339
413
 
340
414
  On-chain encrypted email with `@rouge.quant` / `@qwalla.mail` addresses. All write operations require a `wallet` parameter for ML-DSA-65 request signing — requests are authenticated via `/api/v2/` endpoints with anti-replay nonce protection.
@@ -364,7 +438,7 @@ const name = await rc.mail.reverseLookup(wallet.publicKey);
364
438
  // "alice"
365
439
 
366
440
  // Release a name (signed request)
367
- await rc.mail.releaseName(wallet, "alice", wallet.publicKey);
441
+ await rc.mail.releaseName(wallet, "alice");
368
442
  ```
369
443
 
370
444
  ### Sending & Reading Mail
@@ -393,6 +467,25 @@ await rc.mail.markRead(wallet, messageId);
393
467
  await rc.mail.delete(wallet, messageId);
394
468
  ```
395
469
 
470
+ ### Unread Counts
471
+
472
+ The SDK does not expose a dedicated unread-count endpoint. Derive unread totals client-side from inbox data:
473
+
474
+ ```typescript
475
+ // Mail: count unread inbox items
476
+ const inbox = await rc.mail.getInbox(wallet);
477
+ const unreadMail = inbox.filter((m: any) => {
478
+ const label = m.label ?? {};
479
+ return !(label.is_read ?? label.isRead ?? true);
480
+ }).length;
481
+
482
+ // Messenger: sum unread_count across conversations
483
+ const convos = await rc.messenger.getConversations(wallet);
484
+ const unreadChats = convos.reduce((sum: number, c: any) => {
485
+ return sum + (c.unread_count ?? c.unreadCount ?? 0);
486
+ }, 0);
487
+ ```
488
+
396
489
  ## Messenger (`rc.messenger`)
397
490
 
398
491
  End-to-end encrypted messaging with media and self-destruct support. All operations use ML-DSA-65 signed requests via `/api/v2/` endpoints with nonce-based anti-replay protection.
@@ -425,7 +518,7 @@ await rc.messenger.sendMessage(wallet, conversationId, encryptedContent, {
425
518
  const messages = await rc.messenger.getMessages(wallet, conversationId);
426
519
 
427
520
  // Delete a message (signed request)
428
- await rc.messenger.deleteMessage(wallet, messageId);
521
+ await rc.messenger.deleteMessage(wallet, messageId, conversationId);
429
522
 
430
523
  // Delete a conversation (signed request)
431
524
  await rc.messenger.deleteConversation(wallet, conversationId);
@@ -450,7 +543,7 @@ const stats = await rc.shielded.getStats();
450
543
  // Check if a nullifier has been spent
451
544
  const { spent } = await rc.shielded.isNullifierSpent(note.nullifier);
452
545
 
453
- // Private transfer (requires STARK proof from Rust prover)
546
+ // Private transfer (STARK proof generated by WASM prover in browser or Rust prover on node)
454
547
  await rc.shielded.transfer(wallet, {
455
548
  nullifiers: [note.nullifier],
456
549
  outputCommitments: [recipientCommitment],
@@ -548,6 +641,7 @@ import type {
548
641
  ShieldedNote,
549
642
  RollupStatus, RollupBatchResult, RollupSubmitParams, RollupSubmitResult,
550
643
  FeeInfo, FinalityProof, MintTokenParams, VoteMessage, WsSubscribeMessage,
644
+ SocialPost, PostStats, TrackStats, ArtistStats, SocialComment,
551
645
  } from "@rougechain/sdk";
552
646
  ```
553
647
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rougechain/sdk",
3
- "version": "0.9.0",
3
+ "version": "1.0.0",
4
4
  "description": "Official SDK for RougeChain — post-quantum Layer 1 blockchain secured by ML-DSA-65",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -35,7 +35,7 @@
35
35
  "homepage": "https://rougechain.io",
36
36
  "repository": {
37
37
  "type": "git",
38
- "url": "https://github.com/cyberdreadx/quantum-vault",
38
+ "url": "https://github.com/cyberdreadx/rougechain-node",
39
39
  "directory": "sdk"
40
40
  },
41
41
  "license": "MIT",