Skip to content

done#5

Open
Ckayz wants to merge 1 commit intomainfrom
CK_shadowwire
Open

done#5
Ckayz wants to merge 1 commit intomainfrom
CK_shadowwire

Conversation

@Ckayz
Copy link
Collaborator

@Ckayz Ckayz commented Jan 25, 2026

Summary by CodeRabbit

  • New Features

    • Custom and fixed bet amount modes for flexible game stakes
    • ShadowWire privacy integration for confidential deposits
    • Multi-network support with automatic fallback handling
    • Backend payout processing system
  • Documentation

    • Added ShadowWire integration guide and cost analysis

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

This pull request integrates ShadowWire privacy-preserving payments into a Solana-based card game. It introduces dual-network support (mainnet for payments, devnet for game logic), a new backend payout API, enhanced multi-mode betting with deposit requirements, and WebAssembly bindings for zero-knowledge proof operations.

Changes

Cohort / File(s) Summary
Configuration & Dependencies
.claude/settings.local.json, package.json
Added CLI permissions for bash commands (find, cat, npm ls, grep, git), a confident-executor skill, and new runtime dependencies (@shadowwire, @shadowpay, bip39, ed25519-hd-key) for ShadowWire integration.
Documentation
SHADOWWIRE_COST_GUIDE.md, SHADOWWIRE_IMPLEMENTATION.md, SHADOWWIRE_INTEGRATION_REPORT.md
Three new guides detailing cost breakdown, implementation steps, environment setup, integration points, on-chain program details, and workflow for ShadowWire-enabled deposits and payouts.
Network & Connection Management
components/WalletProvider.jsx, lib/connections.js, hooks/useGameProgram.js
Implemented environment-driven network selection; introduced dual-network connection manager separating mainnet (payments) from devnet (game program); updated game program hook to use devnet connection for account subscriptions and PDA derivation.
Payment & Betting Integration
hooks/useShadowPay.js, components/BetSelector.jsx, pages/api/payout.js, pages/game.js
Reworked payment hook with ShadowWire client lazy-loading, fallback to direct SOL transfers, and payout delegation; added multi-mode BetSelector (preset/custom/fixed) with deposit validation; created backend payout API with balance checks and fee calculation; extended game flow to support host/join/single_player betting modes with deposit requirements.
WebAssembly Integration
public/wasm/settler_wasm.js
Added WebAssembly bindings exposing generate_range_proof, verify_range_proof, and ZKProofResult class for zero-knowledge proof operations.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant BetSelector as BetSelector<br/>(UI)
    participant useShadowPay as useShadowPay<br/>(Hook)
    participant ShadowWire as ShadowWire<br/>SDK
    participant Solana as Solana<br/>Network
    participant Backend as Payout<br/>API

    User->>BetSelector: Select bet amount
    BetSelector->>useShadowPay: call pay(amount, recipient)
    
    alt ShadowWire Enabled & Mainnet
        useShadowPay->>ShadowWire: Initialize client (lazy)
        ShadowWire-->>useShadowPay: Client ready
        useShadowPay->>ShadowWire: Check pool balance
        alt Pool has sufficient balance
            useShadowPay->>ShadowWire: Deposit SOL to pool
            ShadowWire->>Solana: Submit transaction
            Solana-->>ShadowWire: Confirm
            ShadowWire-->>useShadowPay: Success (privacy)
        else Fallback to direct transfer
            useShadowPay->>Solana: Send direct transfer
            Solana-->>useShadowPay: Confirm
        end
    else Devnet or Unavailable
        useShadowPay->>Solana: Send direct SOL transfer
        Solana-->>useShadowPay: Confirm
    end
    
    useShadowPay-->>BetSelector: Payment result
    BetSelector->>User: Display confirmation

    alt Later: Payout triggered
        User->>Backend: Request payout (recipient, amount)
        Backend->>Backend: Verify balance & fees
        Backend->>Solana: Transfer from house wallet
        Solana-->>Backend: Confirm txSignature
        Backend-->>User: Payout response
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes


🐰 A rabbit hops through the networks, devnet and mainnet too,
Privacy payments via shadows, with fallback paths that flew,
Deposits and payouts now shimmer, in multi-mode delight,
Proof proofs in wasm, the game flow shines bright!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant