|
1 | 1 | # @solana/react-hooks |
2 | 2 |
|
| 3 | +## 1.2.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- [#134](https://github.com/solana-foundation/framework-kit/pull/134) [`7c06663`](https://github.com/solana-foundation/framework-kit/commit/7c066635b1d889e878a99c36dfb894b13d13047f) Thanks [@GuiBibeau](https://github.com/GuiBibeau)! - Add wrapSol/unwrapSol helpers for wSOL operations |
| 8 | + |
| 9 | + Adds helper functions to easily wrap native SOL into Wrapped SOL (wSOL) and unwrap it back: |
| 10 | + |
| 11 | + **@solana/client:** |
| 12 | + |
| 13 | + - `createWsolHelper(runtime)` - Factory function to create wSOL helpers |
| 14 | + - `WsolHelper.sendWrap({ amount, authority })` - Wrap SOL to wSOL |
| 15 | + - `WsolHelper.sendUnwrap({ authority })` - Unwrap wSOL back to SOL (closes the account) |
| 16 | + - `WsolHelper.fetchWsolBalance(owner)` - Get wSOL balance |
| 17 | + - `WsolHelper.deriveWsolAddress(owner)` - Derive the wSOL ATA address |
| 18 | + - `WRAPPED_SOL_MINT` - The wSOL mint address constant |
| 19 | + - `createWsolController()` - Controller for React integration |
| 20 | + |
| 21 | + **@solana/react-hooks:** |
| 22 | + |
| 23 | + - `useWrapSol()` - Hook for wrapping/unwrapping SOL with status tracking |
| 24 | + |
| 25 | + Example usage: |
| 26 | + |
| 27 | + ```ts |
| 28 | + // Using the client helper |
| 29 | + const wsol = client.wsol; |
| 30 | + await wsol.sendWrap({ amount: 1_000_000_000n, authority: session }); |
| 31 | + await wsol.sendUnwrap({ authority: session }); |
| 32 | + |
| 33 | + // Using the React hook |
| 34 | + const { wrap, unwrap, balance, isWrapping, isUnwrapping } = useWrapSol(); |
| 35 | + await wrap({ amount: 1_000_000_000n }); |
| 36 | + await unwrap({}); |
| 37 | + ``` |
| 38 | + |
| 39 | +### Patch Changes |
| 40 | + |
| 41 | +- [#132](https://github.com/solana-foundation/framework-kit/pull/132) [`cf3f247`](https://github.com/solana-foundation/framework-kit/commit/cf3f24755fd169c38d053b782c4a1abb3aa467ee) Thanks [@GuiBibeau](https://github.com/GuiBibeau)! - Export React context, return wallet session on wallet connect, and fix circular dependencies |
| 42 | + |
| 43 | +- Updated dependencies [[`7c06663`](https://github.com/solana-foundation/framework-kit/commit/7c066635b1d889e878a99c36dfb894b13d13047f), [`cf3f247`](https://github.com/solana-foundation/framework-kit/commit/cf3f24755fd169c38d053b782c4a1abb3aa467ee)]: |
| 44 | + - @solana/client@1.4.0 |
| 45 | + |
3 | 46 | ## 1.1.12 |
4 | 47 |
|
5 | 48 | ### Patch Changes |
|
0 commit comments