-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
Summary
Add helper functions to easily wrap native SOL into Wrapped SOL (wSOL) and unwrap it back.
Problem to solve
Working with wSOL currently requires developers to manually:
Create an Associated Token Account for wSOL
Transfer SOL to that ATA using system program
Call syncNative instruction
This is complex for beginners and error-prone. Many DeFi protocols require SPL tokens, making wSOL wrapping a common need.
Proposed solution
Add helper functions to @solana/client:
wrapSol(amount: bigint) - Wraps native SOL into wSOL
unwrapSol(amount: bigint) - Unwraps wSOL back to native SOL
Could also be exposed as a React hook: useWrapSol()
Alternatives considered
Manual implementation using useSendTransaction - Works but requires deep Solana knowledge and multiple instructions
External tools/CLI - Doesn't integrate with the app's wallet connection
Third-party libraries - Adds dependencies and doesn't match the framework-kit patterns
Additional context
Discovered during DX testing of useSplToken. Testing wSOL transfers requires wrapping SOL first, but no built-in helper exists.
wSOL mint address: So11111111111111111111111111111111111111112
Problem to solve
jjj
Proposed solution
hg
Alternatives considered
jj
Additional context
jj