Skip to content

Conversation

@GuiBibeau
Copy link
Collaborator

Summary

  • Add WsolHelper with sendWrap() and sendUnwrap() methods for wrapping/unwrapping SOL
  • Add useWrapSol() React hook with balance tracking and status management
  • Export WRAPPED_SOL_MINT constant and all related types
  • Add WrapSolPanel example component to vite-react demo

Usage

// Client helper
const wsol = client.wsol;
await wsol.sendWrap({ amount: 1_000_000_000n, authority: session });
await wsol.sendUnwrap({ authority: session });

// React hook
const { wrap, unwrap, balance, isWrapping, isUnwrapping } = useWrapSol();
await wrap({ amount: 1_000_000_000n });
await unwrap({});

Test plan

  • Build passes
  • Typecheck passes
  • Tested wrap/unwrap in vite-react example app

Closes #116

Add helper functions to easily wrap native SOL into Wrapped SOL (wSOL) and unwrap it back:

@solana/client:
- createWsolHelper(runtime) - Factory function to create wSOL helpers
- WsolHelper.sendWrap({ amount, authority }) - Wrap SOL to wSOL
- WsolHelper.sendUnwrap({ authority }) - Unwrap wSOL back to SOL
- WsolHelper.fetchWsolBalance(owner) - Get wSOL balance
- WsolHelper.deriveWsolAddress(owner) - Derive the wSOL ATA address
- WRAPPED_SOL_MINT - The wSOL mint address constant
- createWsolController() - Controller for React integration

@solana/react-hooks:
- useWrapSol() - Hook for wrapping/unwrapping SOL with status tracking

Also adds WrapSolPanel example component to vite-react demo.

Closes #116
@GuiBibeau GuiBibeau merged commit 7c06663 into main Jan 5, 2026
7 checks passed
@github-actions github-actions bot mentioned this pull request Jan 5, 2026
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.

[Feature]: Add wrapSol/unwrapSol helper for wSOL operations

2 participants