Skip to content

Conversation

@Ricardo-Dinucci
Copy link

Summary

Resolves issue #106 by adding a "Max Stake" button to the storage creation interface in the web example.

Changes Made

  • SHDW Balance Display: Added real-time balance chip showing user's SHDW token balance
  • Max Stake Button: Button that calculates and selects the maximum storage size based on available balance
  • Smart Calculation: Uses 90% of balance for safety, automatically selects appropriate storage tier (1GB/10GB/50GB)
  • Balance Updates: Refreshes balance after storage account creation and wallet connection
  • Error Handling: Proper loading states and error handling for balance queries

Features

  • 🏦 Balance Query: Fetches user's SHDW token balance using associated token account
  • 🎯 Smart Selection: Automatically calculates max affordable storage size
  • 🔄 Real-time Updates: Balance updates on wallet connection and after transactions
  • 🎨 UI Enhancement: Clean balance display with color-coded status
  • 🛡️ Safety: Uses 90% of balance to prevent transaction failures

Technical Implementation

  • Added findAssociatedTokenAddress() helper function for balance queries
  • Implemented calculateMaxStorageFromBalance() for size calculation
  • Added proper React hooks for state management
  • Integrated with existing Material-UI components

Test Plan

  • Button appears next to storage size selector
  • Balance displays correctly when wallet is connected
  • Max stake calculation selects appropriate storage tier
  • Button is disabled when no balance or loading
  • Balance updates after storage account creation

This enhancement makes it much easier for users to stake their maximum available SHDW tokens without manually calculating storage tiers.

🤖 Generated with Claude Code

Ricardo-Dinucci and others added 3 commits June 16, 2025 18:19
Resolves issue GenesysGo#104 by adding comprehensive documentation explaining how to obtain and use GenesysGo Account UUID and Bearer Token. Includes examples for both React and NodeJS implementations with security best practices.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Corrects the previous commit by properly explaining that:
- Shadow Drive uses only Solana wallet signatures (no API keys needed)
- UUID/Bearer Token placeholders are for GenesysGo's RPC service (optional)
- Users can choose any Solana RPC endpoint
- Provides clear options for public RPC vs GenesysGo RPC

Resolves issue GenesysGo#104 with accurate technical details.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolves issue GenesysGo#106 by adding a "Max Stake" button that:
- Displays user's SHDW token balance
- Calculates maximum storage size based on available balance
- Automatically selects the largest storage tier the user can afford
- Updates balance after storage account creation
- Provides clear visual feedback with balance chip

Features added:
- SHDW balance query and display
- Max stakeable amount calculation (90% of balance for safety)
- Smart storage size selection (1GB/10GB/50GB tiers)
- Real-time balance updates
- Proper error handling and loading states

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Ricardo-Dinucci Ricardo-Dinucci requested a review from a team as a code owner June 16, 2025 21:40
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