solana-labs / solana-program-library

A collection of Solana programs maintained by Solana Labs
https://solanalabs.com
Apache License 2.0
3.5k stars 2.04k forks source link

Can't unwrap SOL tokens without closing WSOL account #2748

Closed askibin closed 2 years ago

askibin commented 2 years ago

It is a common approach among different protocols to create WSOL accounts on the fly, send SOL to WSOL (to wrap it automatically), and close them at the end to convert WSOL back to SOL. If it were also possible to transfer WSOL to SOL account with automatic unwrapping, it would come with some benefits:

Arrowana commented 2 years ago

A comment on this, i think wrapping isn't too bad right now, this is the flow i use in frontends:

Drawbacks:

The unwrapping is trivial, with a single call to close_account. However, it might make sense to be able to unwrap without closing.

To make things easier possibly sync native could have a wrapper to do the transfer + sync in one ix.

Extra points:

yenicelik commented 2 years ago

@Arrowana can you point me to one example of unwrapping sol (i.e. close-account?). I have a similar workflow to wrap sol, but a bit confused as to how to unwrap

t-nelson commented 2 years ago

hi. we don't use github for support. please join us in #developer-support on https://solana.com/discord instead