Relating to a previous question: LINK, which covered SOL -> WSOL.
I am building an anchor program that transfers Tokens from one account to another (input and output):
pub struct Payment<'info> {
#[account(mut)]
pub input_token_account: Account<'info, TokenAccount>
pub output_token_account: Account<'info, TokenAccount>
...
}
Although, how would I be able to transfer WSOL from anchor-program-side to SOL user-side. That is, user can request e.g. 2 WSOL from program and get back the equivalent 2 SOL?
I know that you can close the WSOL account as a final instruction, but that just seems like a bad idea since you would be closing the ENTIRE WSOL account and not just the requested 2 SOL