p-token: Add unwrap_lamports instruction#87
Conversation
fafdd3e to
8a3de38
Compare
4409253 to
82fa3b5
Compare
It looks ok, but should it have a feature similar to close, allowing unwrapping the entire available amount? I see a few use cases for this
|
So would it make more sense to always unwrap the entire amount or have both options? |
both options |
b9cdf7c to
369e713
Compare
@Arrowana PR updated. |
buffalojoec
left a comment
There was a problem hiding this comment.
Implementation lgtm, just left a few comments about the tests!
369e713 to
49ddb17
Compare
599d2b1 to
3b92f39
Compare
f300632 to
2cefb4e
Compare
3b92f39 to
20e0ffe
Compare
2cefb4e to
c68c3d3
Compare
The base branch was changed.
20e0ffe to
4db31a0
Compare
Problem
In order to transfer out lamports from native SOL accounts, currently it is necessary to create and close ATAs or token accounts all the time.
Solution
This PR adds a new
unwrap_lamportsinstruction that allows transferring out lamports directly to any destination account. This eliminates the need for creating temporary native token accounts for the recipient.The new instruction uses the discriminator
3945, which is currently unused in Token-2022.The amount to unwrap is specified as an
Option<u64>:None: the entire token balance is unwrapSome(amount): the specified amount is unwrap