Conversation
📝 WalkthroughWalkthroughThis 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Note 🎁 Summarized by CodeRabbit FreeYour 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 |
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.