prepareCreatingWSOLAccountAndCloseWhenDone(from_amount_payer_minRentExemption_) - p2p-org/solana-swift GitHub Wiki
prepareCreatingWSOLAccountAndCloseWhenDone(from:amount:payer:minRentExemption:)
Prepare instructions for creating WSOL account and close it after finishing transaction to return funds back to native SOL account
public func prepareCreatingWSOLAccountAndCloseWhenDone(
from owner: PublicKey,
amount: Lamports,
payer: PublicKey,
minRentExemption mre: Lamports?
)
Parameters
- owner: The owner of new WSOL account
- amount: The initial amount in Lamports to transfer to the new WSOL account
- payer: The payer of the transaction (usually the owner)
- mre: The min rent exemption (leave it nil if there is no pre-defined)
Returns
AccountInstructions that contains needed instructions, signers, .etc