SPLTokenSwapProgram.withdrawSingleToken constructor
SPLTokenSwapProgram.withdrawSingleToken({
- required SolAddress tokenSwap,
- required SolAddress authority,
- required SolAddress userTransferAuthority,
- required SolAddress poolMint,
- required SolAddress feeAccount,
- required SolAddress sourcePoolAccount,
- required SolAddress fromA,
- required SolAddress fromB,
- required SolAddress destinationAccount,
- required SolAddress destinationMint,
- required SolAddress poolTokenProgramId,
- required SolAddress destinationTokenProgramId,
- required SPLTokenSwapWithdrawSingleTokenLayout layout,
- required SolAddress swapProgramId,
Withdraw one token type from the pool at the current ratio given the exact amount out expected.
Implementation
factory SPLTokenSwapProgram.withdrawSingleToken({
/// Token-swap
required SolAddress tokenSwap,
/// swap authority
required SolAddress authority,
/// user transfer authority
required SolAddress userTransferAuthority,
/// Pool mint account, swap authority is the owner
required SolAddress poolMint,
/// Fee account, to receive withdrawal fees
required SolAddress feeAccount,
/// SOURCE Pool account, amount is transferable by user
/// transfer authority.
required SolAddress sourcePoolAccount,
/// token_a Swap Account to potentially withdraw from.
required SolAddress fromA,
/// token_b Swap Account to potentially withdraw from.
required SolAddress fromB,
/// Destination account
required SolAddress destinationAccount,
/// Token (A|B) DESTINATION mint
required SolAddress destinationMint,
/// Pool Token program id
required SolAddress poolTokenProgramId,
/// Token (A|B) DESTINATION program id
required SolAddress destinationTokenProgramId,
required SPLTokenSwapWithdrawSingleTokenLayout layout,
required SolAddress swapProgramId,
}) {
return SPLTokenSwapProgram(
layout: layout,
keys: [
tokenSwap.toReadOnly(),
authority.toReadOnly(),
userTransferAuthority.toSigner(),
poolMint.toWritable(),
sourcePoolAccount.toWritable(),
fromA.toWritable(),
fromB.toWritable(),
destinationAccount.toWritable(),
feeAccount.toWritable(),
destinationMint.toReadOnly(),
poolTokenProgramId.toReadOnly(),
destinationTokenProgramId.toReadOnly()
],
programId: swapProgramId);
}